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

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Fri Jun 10 07:34:00 GMT 2016


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

--- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 10 Jun 2016, ubizjak at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71460
> 
> --- Comment #19 from Uroš Bizjak <ubizjak at gmail dot com> ---
> (In reply to Uroš Bizjak from comment #18)
> > (In reply to rguenther@suse.de from comment #17)
> > > But this also hints at the ABI for
> > > 
> > > void foo (union U { int x; float y; });
> > > 
> > > changing with the patch, no?  Or ultimatively at the FE using a bogus
> > > check to verify ABI compatibility (just looking at TYPE_MODE).
> 
> Following test doesn't compile with patched compiler:
> 
> --cut here--
> union U { int x; float y; } __attribute__ ((transparent_union));
> 
> void foo (union U);
> 
> void test (void)
> {
>   union U t;
> 
>   foo (1.0f);
> 
>   foo (1);
> }
> --cut here--
> 
> -O2 -mfpmath=387 -m32:
> 
> union.c:1:7: warning: union cannot be made transparent
>  union U { int x; float y; } __attribute__ ((transparent_union));
> 
> but does compile OK with:
> 
> -msse -O2 -mfpmath=sse -m32

So another way to avoid the issue in this PR is to not change the
types mode but avoid using TYPE_MODE when expanding aggregate copies
and those modes would be "bad" (not sure if we can somehow use the
same target hook for this).  But it really seems the hook was designed
for this ...


More information about the Gcc-bugs mailing list