[Bug tree-optimization/80652] [5 Regression] Union conversion between __m128d and double array does not work under 5.0 through 6.2
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 17 07:16:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80652
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Peter Boyle from comment #6)
> Just a comment -- suggest a warning thrown if union access from
> two views is made. AFAIK g++ is the only compiler not implementing the
> defacto type pun use.
>
> http://en.cppreference.com/w/cpp/language/union
>
> "Many compilers implement, as a non-standard language extension, the ability
> to read inactive members of a union."
Actually it does except you are accessing not directly from the union but
rather than via a pointer (reference) which is where the problem comes in.
Just change: "const scalar &a" to be "const scalar a" and you see the behavior
you originally expected.
More information about the Gcc-bugs
mailing list