[Bug target/71460] Copying structs can trap (on x86-32) due to SNaN to QNaN

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 8 17:49:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71460

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Wed, 8 Jun 2016, ch3root at openwall dot com wrote:

> - padding in long double is not copied. Probably ok (in the same way as padding
> in substructures is not always copied);

Yes, I think that's fine in struct copying.

> - sNaNs are turned into qNaNs on x86-32 if traps are turned off. Probably ok if
> sNaNs and qNaNs are considered different representations of the same value;

For *scalar* assignment that would be fine because of TS 18661-1 saying 
"Whether C assignment (6.5.16) (and conversion as if by assignment) to the 
same format is an IEC 60559 convertFormat or copy operation is 
implementation-defined, even if <fenv.h> defines the macro 
FE_SNANS_ALWAYS_SIGNAL (F.2.1).".  It's rather less clear for struct 
assignment.

I expect the present bug is essentially the same as bug 58416 (which 
concerns a union, where the floating-point member isn't even the active 
one).


More information about the Gcc-bugs mailing list