char *foo(char *p1)
{
  return (p1+0x7fffffff) > p1 ? (p1+0x7fffffff) : (char *)-1;
}

We fold the expression to return p1+0x7fffffff because we think that
the comparison is equal to 0x7fffffff > 0.  Again a problem of my
array-like-ref comparison folding.

I have a fix.


-- 
           Summary: [4.1/4.2 Regression] Overflow not handled in ptr
                    arithmetic folding
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
        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=25512

Reply via email to