This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/39322] New: [4.4 regression] Bogus aliasing warning
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Feb 2009 22:20:22 -0000
- Subject: [Bug middle-end/39322] New: [4.4 regression] Bogus aliasing warning
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
A IMHO the trunk issues a bogus warning for the following code snippet
when compiling it with "-O2 -Wall" using the C++ frontend:
==============================
int foo()
{
char a[10];
int i = *(int*)&a[4];
int j = *(int*)(a+4);
return i+j;
}
==============================
bug.cc: In function 'int foo()':
bug.cc:4: warning: dereferencing type-punned pointer will break strict-aliasing
rules
Interestingly, the warning is given only for line 4, but not line 5.
Also the C frontend is not affected.
If there's wrong alias info involved, this might lead to wrong-code bugs.
--
Summary: [4.4 regression] Bogus aliasing warning
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: diagnostic, monitored
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39322