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]
Other format: [Raw text]

[Bug c/50254] New: gcc-4.5 -fstrict-aliasing -fschedule-insns optimization produces wrong code


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

             Bug #: 50254
           Summary: gcc-4.5 -fstrict-aliasing -fschedule-insns
                    optimization produces wrong code
    Classification: Unclassified
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vzapolskiy@gmail.com


Created attachment 25154
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25154
test code

Hello,

recently my team found a problem in our code after a gcc compiler update from
gcc-4.4 to gcc-4.5. I've extracted the problematic code snippet, you can find
it in the attachement.

The problem is unveiled, if you try to compile the test with various
combinations of base optimization and strict-aliasing and fschedule-insns
flags.

For instance that's what I get on my amd64/gcc-4.6.0:
<log>
$ gcc -O0                                          test.c -o test && ./test
$ gcc -O0                      -fschedule-insns    test.c -o test && ./test
$ gcc -O0 -fstrict-aliasing                        test.c -o test && ./test
$ gcc -O0 -fstrict-aliasing    -fschedule-insns    test.c -o test && ./test
Aborted
$ gcc -O1                                          test.c -o test && ./test
$ gcc -O1                      -fschedule-insns    test.c -o test && ./test
$ gcc -O1 -fstrict-aliasing                        test.c -o test && ./test
Aborted
$ gcc -O1 -fstrict-aliasing    -fschedule-insns    test.c -o test && ./test
Aborted
$ gcc -O2                                          test.c -o test && ./test
Aborted
$ gcc -O2 -fno-strict-aliasing                     test.c -o test && ./test
$ gcc -O2                      -fno-schedule-insns test.c -o test && ./test
Aborted
$ gcc -O2 -fno-strict-aliasing -fno-schedule-insns test.c -o test && ./test
$ 
</log>

The problem described above is reproducible on armv7, i386, amd64 target
architectures with gcc-4.5 and gcc-4.6 compilers.

The issue might be invalid, but because it hasn't been known with gcc-4.4, I'd
greatly appreciate to get some comments from GCC team on it.

Thank you in advance.


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