Taylan Ulrich Bayirli/Kammer <taylanbayi...@gmail.com> writes: > The next roadblock I hit is that when I run gdb on the guile > executable, it doesn't seem to realize that the libguile dylib is > loaded, so still lacks the debug symbols from it. (When I enter "info > sharedlibrary" it says "No shared libraries loaded at this time" > although the Guile REPL and all runs, so libguile is obviously > loaded.) I'll continue tomorrow if I have time again at work.
Update: I gave up on gdb on OS X and tried the native lldb, which essentially worked but failed to print relevant stack variables (maybe because of -O2). I resorted to printf debugging, but at least had immediate success! I can reproduce the problem with the following minimal program, compiled with -O1 (not necessarily -O2): /* BEGIN */ #include <stdio.h> #include <math.h> int main (int argc) { double ang = 0, s, c; /* Prevent constant-propagation. */ /* (Program must be called with no arguments.) */ if (argc == 1) ang = -0.0; s = sin (ang); c = cos (ang); /* This line is needed to reproduce. */ printf("%f\n", s); /* Prints "0.000000". */ return c /* Prevent c from being optimized out. */; } /* END */ I don't know why `c' and/or the `cos (ang)' call are needed, but I fail to reproduce the bug after only slight, seemingly irrelevant changes. With the native clang on the system, the bug can't be reproduced. Channel #gcc on Freenode suggested trying out -m32 vs. -m64, and -mfpmath=387 vs. -mfpmath=sse, but the bug persists with all combinations. I also tried out other GCC packages of MacPorts: GCC 4.3 through 4.9 all have the bug. The plain GCC 4.2 package is not supported on recent OS X versions. Apple-patched GCC 4.2 does *not* have the bug. (There are no more recent Apple-patched GCC versions.) I suppose I should move this to the GCC mailing list? Taylan