On Friday, April 12, 2013 1:57:40 AM UTC-7,
ol...@okmij.org wrote:
> I think Darwin and Ubuntu might be using different compilers (I think
> Apple bet on LLVM/clang). Even when both system use GCC, chances are
> they are of different versions, and some are more aggressive than
> others (at optimization). The first thing to try is to compile
> testd0opt without optimization (set -O0 or something like
> that). Second, if there is a way to get a stack trace on seg fault
> (e.g., via GDB) that could be helpful.
>
> BTW, it helps to compile stacks-native.c with the DEBUG
> option. One can use either -DDEBUG or change
>
> #define DEBUG 0
>
> at the beginning of the file so it reads "#define DEBUG 1". Now when
> running the tesd0opt we should see more output. It would be good to
> get the whole output of running tesd0opt.
>
> And another thing: for native delimcc we don't have to use dynamic
> linking. One may link in delimcc.cmx along with stacks-native.o
> statically. Perhaps that might help.
Once again, spot on, and this is a little disturbing: I got almost-correct output with -O0 and -DDEBUG=1, but there was still a message about "can't happen" at the very end, still using Apple's GCC 4.2.1 for Mac OS X 10.6.8. I got similarly incorrect results using the current release, 3.2, of clang. I then remembered that, some time ago, I'd installed a binary of a much more recent GCC—4.6.2—that I could optionally use. Using it, I get correct results from testd0opt, even without using -O0!
So stacks-native seems to throw both Apple's old GCC and _current_ clang for a loop, but even a minor dot-revision old GCC deals with it just fine. I find this surprising.
In any case, it's not delimcc.0's issue, so I have no patch to put into a pull request. I just need to be careful in choosing what tools to build with on my platform. :-)
Thanks for the help!
Paul