This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/71486] Transparent union doesn't work with long double for x86_64
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jun 2016 09:45:57 +0000
- Subject: [Bug target/71486] Transparent union doesn't work with long double for x86_64
- Auto-submitted: auto-generated
- References: <bug-71486-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71486
--- Comment #2 from UroÅ Bizjak <ubizjak at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> I thought the ABI for transparent unions was that of passing its members.
>
> But int128 and long double are passed differently.
Similar case compiles OK (value in int reg vs. value in XMM reg):
--cut here--
union U { long x; double y; } __attribute__ ((transparent_union));
void foo (union U);
void test (void)
{
union U t;
foo (1.0);
foo (1L);
}
--cut here--
-O2:
movabsq $4607182418800017408, %rdi
call foo
movl $1, %edi
call foo
and even following for 32bit target, value in int reg vs. memory:
--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 -m32 -mregparm=1:
movl $1065353216, %eax
call foo
movl $1, %eax
call foo