From: Johan L. <jo...@li...> - 2005-11-22 06:03:59
|
On Nov 21, 2005, at 19:22, Sam Steingold wrote: > SUMMARY: > > segfault on startup in closed_buffered() when built with "gcc -O2" > > Exception: EXC_BAD_ACCESS (0x0001) > Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x19fb6130 > > Thread 0 Crashed: > 0 lisp.run 0x0006f8b4 closed_buffered + 48 (crt.c:355) > 1 lisp.run 0x0007850c closed_all_files + 108 (crt.c:355) > 2 lisp.run 0x000289ac loadmem_from_handle + 3168 (crt.c:355) > 3 lisp.run 0x00028c68 loadmem + 128 (crt.c:355) > 4 lisp.run 0x00029058 init_memory + 888 (crt.c:355) > 5 lisp.run 0x0002b610 main + 3940 (crt.c:355) > 6 lisp.run 0x00002878 _start + 340 (crt.c:272) > 7 lisp.run 0x00002720 start + 60 > > no segfault when built with "gcc -g" > > is this correct? Correct, but see below. > my current conjecture is that this is a GCC bug. I think you may be right; I recently upgraded to Apples Xcode Tools 2.2, which includes GCC 4.0.1. Before (this thread) I have been using GCC 4.0.0. I now also recompiled CLISP 2.35 using GCC 4.0.1, which also gives the segfault (sorry for not figuring that out earlier). > gcc --version powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5247) > uname -a Darwin Johans-Computer.local 8.3.0 Darwin Kernel Version 8.3.0: Mon Oct 3 20:04:04 PDT 2005; root:xnu-792.6.22.obj~2/RELEASE_PPC Power Macintosh powerpc > could you please figure out which optimization switch causes this? > you will need to > 1. configure as usual (no "--with-debug") > 2. build, make sure that you get the crash. > 3. edit build/Makefile and change CFLAGS, removing some optimization > flags > 4. build again and see if you get the crash. > > when you find the specific optimization flag that causes the crash, > please report it here so that makemake will omit it on macos. The "-DSAFETY=3" seems to do the trick. Adding this flag to the original CFLAGS gives a build that does not crash. The CFLAGS that works for me looks like: CFLAGS = -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn- type -Wmissing-declarations -Wno-sign-compare -O2 -DSAFETY=3 - DUNIX_BINARY_DISTRIB -DUNICODE -DDYNAMIC_FFI -I. I also tried all the combinations below, and they all segfault: * "gcc -O" * "gcc" (no optimaztion) * "gcc -falign-functions=4" (no optimization) * "gcc -falign-functions=4 -g" -- Johan Liseborn |