This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/25512] New: [4.1/4.2 Regression] Overflow not handled in ptr arithmetic folding
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2005 10:51:01 -0000
- Subject: [Bug middle-end/25512] New: [4.1/4.2 Regression] Overflow not handled in ptr arithmetic folding
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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