caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Caml Light 0.8 and -fstrict-aliasing build issue
@ 2009-07-20 12:58 Alexis ROBERT
  0 siblings, 0 replies; only message in thread
From: Alexis ROBERT @ 2009-07-20 12:58 UTC (permalink / raw)
  To: caml-list

Hello,

As the MPSI programme force us to use Caml Light instead of OCaml (our 
teachers hit us each time we pronounce ocaml :) ), I tried to build the 
sources on my computer, but during the build, I got this :

make[1]: Entering directory `/home/alexis/camllight/src/lib'
../camlrun ../camlcomp -stdlib . -O none -g -W string.mli
make[1]: *** [string.zi] Segmentation fault

More precisely, gdb told me that :

(gdb) run ../camlcomp -stdlib . -O none -g -W string.mli
Starting program: /home/alexis/camllight/src/camlrun ../camlcomp -stdlib 
. -O none -g -W arg.mli

Program received signal SIGSEGV, Segmentation fault.
interprete (prog=0xe0e960 "\006\016") at interp.c:508
508          cur_instr = *pc++; <= In the real source code, that's Next; 
I changed it with the macro content for more lisibility :)
(gdb) info locals
pc = (code_t) 0x9 <Address 0x9 out of bounds>
cur_instr = <value optimized out>
[...]

The reason of the segfaults seems to be linked with -fstrict-aliasing 
(included in -O2, I discovered it when disabling gcc optimizations to 
get cur_instr value). In fact, the weird thing is that pc pointer 
suddently decreases to 0x09, which doesn't seem to be a very sweet 
memory address, and causes a segfault in the Next macro when it 
deferences pc.

I've tried to follow pc using a watchpoint before the magic change, but 
it disables the watchpoint every time it reaches a segment of code where 
pc is not defined which makes the debugging process *very* annoying :)

A workaround would be to use OPTS="-fno-strict-aliasing" in 
runtime/Makefile line 5, but I don't know if it's very clean (or to 
disable direct jumping but that's even worse :D ).

My computer is running Ubuntu 9.04 with gcc 4.3.3 and a x86_64 cpu (I 
used the CVS version of caml light). It _MAY_ be a x86_64 only issue as 
I vaguely remember a friend having the same configuration as mine using 
Ubuntu x86 who has successfully built caml light, but I may have forgot 
some details.

Thanks !

Alexis ROBERT


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-20 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-20 12:58 Caml Light 0.8 and -fstrict-aliasing build issue Alexis ROBERT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).