[Bug tree-optimization/61064] New: ARM G++ compiler mis-optimizes safe Abs function

quanxunzhen at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon May 5 12:37:00 GMT 2014


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

            Bug ID: 61064
           Summary: ARM G++ compiler mis-optimizes safe Abs function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: quanxunzhen at gmail dot com

Created attachment 32737
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32737&action=edit
testcase

The attachment is the code shows this problem. It is some code extracted from
mozilla. Sorry for such large code, but I could not reproduce this problem when
it was simplified.

If you compile mytest.cpp with ARM G++ (I tested 4.6 and 4.8), and then input
-2147483648, it will shows that the absolute value of this number is smaller
than 2147483647.

In this code, a safe Abs implementation is used. However, it seems that ARM G++
mis-optimizes it when -O2 is applied. This problem is not present in clang++ or
x86 G++.



More information about the Gcc-bugs mailing list