From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2F3B6BBAF for ; Mon, 20 Jul 2009 14:58:13 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj8BAD4GZErRVdvSkWdsb2JhbACZHD8BAQEBCQkMBxGkaoEbjiMBAwIEhAgF X-IronPort-AV: E=Sophos;i="4.43,234,1246831200"; d="scan'208";a="30070189" Received: from mail-ew0-f210.google.com ([209.85.219.210]) by mail2-smtp-roc.national.inria.fr with ESMTP; 20 Jul 2009 14:58:12 +0200 Received: by ewy6 with SMTP id 6so2219261ewy.27 for ; Mon, 20 Jul 2009 05:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=A0ROztxbihsBMvVZQ45rkmpu35bRsj3DDmpdLURKTcg=; b=iBGjgYI9uwStQaoXeoE3CGOgWKh/j7PyIwFjIyAW+xJwPEuJu/kjQorVQeF/r2dCr3 SdxIh/0GYwL/JWthPJ/dmm6GLQtYAeD20+aD+F+q2BIqM1buNmJcm7NY1jclzoe6QkZy Txow/q9mdmlFPV1N7RcsTiUdRMULshOarig+Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=JhyPVZZ6rPXlmumk5TAlaGBkSxo3Z+kHufqpIn+VRXqqaURfXOU3/5YWumVfqZOnyt IuLac9DW60N8nTboIOn65TYjA6mVQa46w9B3fSe86YyBvWkVHZiwoICsXWWxK9HRqvFh lucDuyh7VA4l4jboVgMJ09Pwan6b12BEYUXmI= Received: by 10.210.42.13 with SMTP id p13mr5085809ebp.36.1248094690746; Mon, 20 Jul 2009 05:58:10 -0700 (PDT) Received: from ?192.168.0.50? (robertlan.eu.org [81.57.34.8]) by mx.google.com with ESMTPS id 24sm1113297eyx.23.2009.07.20.05.58.10 (version=SSLv3 cipher=RC4-MD5); Mon, 20 Jul 2009 05:58:10 -0700 (PDT) Message-ID: <4A6469E1.6050502@gmail.com> Date: Mon, 20 Jul 2009 14:58:09 +0200 From: Alexis ROBERT User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Caml Light 0.8 and -fstrict-aliasing build issue Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; mpsi:01 ocaml:01 ocaml:01 lib':01 camlrun:01 camlcomp:01 -stdlib:01 mli:01 gdb:01 gdb:01 camlcomp:01 -stdlib:01 mli:01 camlrun:01 interprete:01 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
cur_instr = [...] 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