This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36227] New: [4.3/4.4 Regression] POINTER_PLUS folding introduces undefined overflow
- 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: 13 May 2008 12:42:26 -0000
- Subject: [Bug middle-end/36227] New: [4.3/4.4 Regression] POINTER_PLUS folding introduces undefined overflow
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
unsigned long * sat_add(unsigned long *ptr, unsigned long i, unsigned long
*end)
{
if ((unsigned long)ptr + i * sizeof(*ptr) > (unsigned long)ptr)
return ptr + i;
else
return end;
}
is folded to
if (ptr + (long unsigned int) (i * 8) > ptr)
{
return ptr + (long unsigned int) (i * 8);
}
else
{
return end;
}
--
Summary: [4.3/4.4 Regression] POINTER_PLUS folding introduces
undefined overflow
Product: gcc
Version: 4.4.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=36227