Message-ID: <323FABEA.672F@pobox.oleane.com> Date: Wed, 18 Sep 1996 09:59:38 +0200 From: Francois Charton Organization: CCMSA MIME-Version: 1.0 To: Francois Charton CC: djgpp AT delorie DOT com Subject: Re: Optimize switch -O2 create FPU error References: <323D96D7 DOT 5DA0 AT lem DOT ch DOT unito DOT it> <323E757F DOT 73B58D0 AT frw DOT ruu DOT nl> <323FAA5F DOT 2414 AT pobox DOT oleane DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cees Wesseling wrote: > > Carlo Nervi wrote: > > > > my program works fine under djgpp v1.12, but exit with SIGFPE > > exception under djgpp v2.00. Using fsdb something strange happen: > > sometimes it exit with a Underflow exception, but sometime else > > running under fsdb the program runs, but with wrong numeric results. > > > > Finally I was able to catch the problem: by using -O2 or -O3 > > optimization switches the problem persist, whereas by using -O > > the problem disappear totally. > > Anybody had similar experience or it is due to a bug already solved > > which a don't know? > Yes, I did have the same problem, in a piece of code that has very > long and complicated expression. My guess is that this version of > gcc just flaws on the optimization. I simply wait for the next > release. You might want to try some code re-arranging to solve the > problem. > > >It might be another occurence of a known bug in libm.a, whch causes FPUexceptions. To avoid it : 1/ remove -lm from your linking script; gcc will then link the libc.a math functions, instead of libm.a. These are not buggy... (this will work all the time, provided you don't use the gamma or bessel functions, which are defined in libm but not in libc...). 2/ get a modified libm.a by T. Demmer in : ftp.lstm.ruhr-uni-bochum.de/pub/djgpp Regards Francois