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 middle-end/25512] New: [4.1/4.2 Regression] Overflow not handled in ptr arithmetic folding


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


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