Version française
Home     About     Download     Resources     Contact us    
Browse thread
Warning: gcc -O2 bad for compiling Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <Basile.Starynkevitch@w...>
Subject: Warning: gcc -O2 bad for compiling Ocaml
Hello All,

I compiled ocaml-2.99+18 (2000-04-14, from CVS). But I wanted to get a
little faster runtime (compiled with gcc-2.95.2 on a Linux Suse6.2
-glibc2- AMDK6 PC, my home machine). So I edited manually
config/Makefile to add -O2 at end of BYTECCCOMPOPTS and
NATIVECCCOMPOPTS.

This seems to work ok for Ocaml proper (make bootstrap runs ok, as
do make opt, make ocamlopt.opt etc...). 

But I tried to compile Fabrice Le Fessant latest patched efun editor 
"http://pauillac.inria.fr/efuns/ftp/efuns-017+1.src.tar.gz"

This does not work (in efuns/efuns, make opt fails), ending with:

ocamlopt.opt  -I ../ocamlsrc -I ../dynlink -I ../toolkit -I ../concur -I /h1/basile/ltmp/efuns/xlib -I /h1/basile/ltmp/efuns/common -c ebuffer.ml
The compiled interfaces keymap.cmi and ebuffer.cmi
make inconsistent assumptions over interface Efuns
make[1]: *** [ebuffer.cmx] Erreur 2

This is repeatable on other systems.

I thought there was a bug in Ocaml or Efuns. The bug was mine:

   DO NOT COMPILE OCAML WITH gcc -O2

(the same bug appears with other optimizations such as -Os or
-fomit-frame-ponter)


My public apologies to Fabrice (Le Fessant) and Xavier (Leroy) for
having lost their time.

I suggest adding in Ocaml INSTALL file the following line of advice:

  Warning: do not compile the Ocaml system with any other optimisation
  that gcc -O. On somes occasions, compiling Ocaml with gcc -O2 produces
  a buggy compiler or runtime.

################ résumé francais:

Il faut éviter de compiler l'environement OCaml avec gcc -O2 (ou toute
autre optimisation que -O). Dans certains cas, cela produit un
compilateur ou un système d'exécution incorrect.

Mes excuses publiques pour avoir fait perdre leur temps à Fabrice (Le
Fessant) and Xavier (Leroy) à ce propos.

################


-- 
Basile STARYNKEVITCH - 8 rue de la Faiencerie, 92340 BOURG LA REINE (France)
tel 01.46.65.45.53. email = basile point starynkevitch at wanadoo point fr
http://perso.wanadoo.fr/starynkevitch/basile 
antispam: <abuse@wanadoo.fr>