This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GCC generates incorrect code when optimising


Attached is a file demonstrating this.
I've tried to simplify this as much as possible. As far as I can tell, it's
a compiler bug and not something wrong with my program.

The first command in main() should read a value from a function, add 1, and
print it. This should always result in 11 as the function always returns 10.
But if -O and -fomit-frame-pointer are enabled, it throws away the return
value and prints an incorrect answer.

The annoying thing is, there's some other code after this bit that
technically should have no effect, but if I remove it the bug goes away...

Any ideas guys? :-|
-----------------------------------------------
Richard Mitton,
richard.mitton@bigfoot.com
-----------------------------------------------

test.c


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]