Bug in egcc optimization (f point ops give wrong answers)

Enrique Zanardi ezanardi@ull.es
Mon May 25 06:59:00 GMT 1998


On Sat, May 23, 1998 at 04:55:54PM -0400, Craig Burley wrote:
> 
> Hmm, not enough, because it works fine for me on my RedHat 4.2-based
> system, using egcs 1.0.2 and 1.0.3, with -O2, even explicitly
> specifying -fforce-mem.

So it may be a libc6 effect?
 
> Moreover, looking at the output of -S, I can't see anything remotely
> like the assembly code you sent me coming out of the compiled
> c_log.c routine!  Where you've got the fpatan instruction, I see
> a call to atan2, which likely explains why the rest of the code
> is so different -- your compiler is open-coding calls to atan2,
> mine is not, and offhand I don't know why they're different.
> 
> Could you resend your bug report with the complete output of -S,
> so we can see more about your machine and the options that
> are enabled?  That might help someone reproduce the problem
> more quickly.

OK, the "buggy" assembly listings are attached. Also attached is the
"diff -r right-answer/*.s wrong-answer/*.s" output.

> In the meantime, note that this is definitely not a g77 bug; g77
> isn't involved in this at all, though its copy of netlib's libf2c
> is the source of some of the C code you're using.

Yes, it's not a g77 bug. I was told about that bug by someone that was 
using the following fortran test program:
	complex xj
	xj=(1.0,1.0)
	write (*,*) log(xj)
	end
so at first glance, g77 was the one to blame. It turned out that
libf2c routines were compiled with egcc -O2, and egcc was producing the 
wrong code. 

--
Enrique Zanardi						   ezanardi@ull.es


More information about the Gcc-bugs mailing list