caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alexis ROBERT <alexis.robert@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Caml Light 0.8 and -fstrict-aliasing build issue
Date: Mon, 20 Jul 2009 14:58:09 +0200	[thread overview]
Message-ID: <4A6469E1.6050502@gmail.com> (raw)

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


                 reply	other threads:[~2009-07-20 12:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A6469E1.6050502@gmail.com \
    --to=alexis.robert@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).