This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/79671] [7 Regression] mapnik miscompilation on armv7hl since r235622
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 24 Mar 2017 13:49:07 +0000
- Subject: [Bug target/79671] [7 Regression] mapnik miscompilation on armv7hl since r235622
- Auto-submitted: auto-generated
- References: <bug-79671-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
--- Comment #38 from Richard Biener <rguenth at gcc dot gnu.org> ---
Simplified testcase for discussion (is not "miscompiled"):
struct S {
union { int i; } u;
};
int main()
{
S s;
new (&s.u.i) float (2.0);
S q = s;
if (*reinterpret_cast<float *>(&q.u.i) != 2.0)
abort ();
}
so you say q = s is valid because the object representation of the union
is copied. I say after storing 2.0 to s.u.i the access 's' in q = s is
invalid as you are accessing the stored value (a float) via a glvalue of
inappropriate type.