Overoptimization

Jeffrey A Law law@cygnus.com
Wed Apr 12 09:28:00 GMT 2000


  In message < Pine.GSO.4.00.10004072108270.475-101000@lina.cli.di.unipi.it >you 
write:
  > The following program gives different results depending of the
  > optimization options.
  > 
  > $ gcc -Wall -O0 tail.c -o tail
  > $ ./tail
  > 1
  > $ gcc -Wall -O1 tail.c -o tail
  > $ ./tail
  > 0
  > 
  > $ gcc --version
  > egcs-2.91.66
  > 
  > (gcc-2.95.2 yields the same result)
  > 
  > I've attached the output of gcc -v --save-temps etc.
Thanks.  Yes, this is GCC bug.  I've added it to the regression testsuite.

For someone interested in fixing the bug -- probably the best fix is to 
remove the old tail recursion support from stmt.c and instead rely on the
new stuff in sibcall.c.  The new code  knows how to deal with ADDRESSOF
expressions -- the old code does not.

jeff



More information about the Gcc-bugs mailing list