[Bug c/56180] New: Strange behaviour with optimization (using K&R C)

paulo_torrens at hotmail dot com gcc-bugzilla@gcc.gnu.org
Sat Feb 2 09:00:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56180

             Bug #: 56180
           Summary: Strange behaviour with optimization (using K&R C)
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: paulo_torrens@hotmail.com


I'm writing a piece of code that needs to be on old K&R C style, and found a
problem recently.

When using no optimization I get one behaviour, with -O1 I get another, and
with -O2 I get *yet another* behaviour. Both GCC and CLang show the same
behaviour (although GCC shows three "versions" of the results, and CLang shows
only two).


There is probably something I did wrong in the code itself, I got the part of
the program that showed the problem and placed it on a single test C file,
which still showed the problem... although probably is some logic error of
mine, the compiler shouldn't show different behaviours.




The source code [test.c]: http://pastebin.com/SS1JHH1n
The test file [test.psy]: http://pastebin.com/ejLqYaxH



I'm not sure what is the problem over here, so I decided to report. :)



More information about the Gcc-bugs mailing list