https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80163
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 41042
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41042&action=edit
gcc7-pr80163.patch
There are multiple issues, I'm just attaching an untested fix for a related bug
where if the inner type of the conversion is unsigned, we still use
SIGN_EXTEND.
Are you sure clang accepts it? The versions I've tried reject it.
And ICC just silently miscompiles it. Make that e.g.
void bar (void);
__int128_t *
foo (void)
{
a:
bar ();
b:;
static __int128_t d = (long) &&a - (long) &&b;
return &d;
}
so that it doesn't optimize away and you'll see it emits
d.3:
.quad .L_2TAG_PACKET_0 - .L_2TAG_PACKET_1
.space 8, 0x00 # pad
which isn't sign-extended, but zero-extended. There are no relocations that
can achieve that though, so I think we need to reject this testcase.