------- Comment #12 from rguenth at gcc dot gnu dot org 2009-01-12 14:25
-------
This isn't really a warning from system headers:
test.cpp:14: warning: dereferencing pointer '__x.13' does break strict-aliasing
rules
the location for the dereference is in test.cpp (if that is correct or not
is another issue). There is at least a bug that we will emit the note: part
even if the warning was suppressed - I am going to fix that.
I can omit the warning for pointers that are declared in system headers
in addition to that. Probably this is what is the better behavior - but
I cannot easily report the dereference location even if it is in a system
header but the pointer is _not_ from a system header -- which is probably
what would be wanted here.
So,
t.h:
#pragma GCC system_header
inline float deref_float (float *p) { return *p; }
t.C:
#include "t.h"
float transform(int i)
{
return deref_float ((float *)&i);
}
_should_ emit a warning? Even if it looks like
t.h: In function 'float transform(int)':
t.h:3: warning: dereferencing pointer 'i.0' does break strict-aliasing rules
t.C:5: note: initialized from here
?
IMHO we want to warn unless _both_, the declaration and the dereference is
in a system header.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-01-12 14:25:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38477