[Bug tree-optimization/45232] New: Several passes introduce undefined overflow

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Aug 8 12:31:00 GMT 2010


Fold:

extern void abort (void);
int i = 1;
int main()
{
 if ((i - 1) - (-__INT_MAX__ - 1) != (-__INT_MAX__ - 1))
   abort ();
 return 0;
}

Forwprop (and reassoc with -fno-tree-forwprop) at -O1:

extern void abort (void);
int i = 1;
int main()
{
 int j = i - 1;
 j = j - (-__INT_MAX__ - 1);
 if (j != (-__INT_MAX__ - 1))
   abort ();
 return 0;
}

Not so VRP itself (it doesn't derive ranges from VARYING +- CST for
signed arithmetic).


-- 
           Summary: Several passes introduce undefined overflow
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list