https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127099
Bug ID: 127099
Summary: Wrong code with bitint and nested shifts
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
typedef unsigned _BitInt(4) u4;
__attribute__ ((noipa))
unsigned int
f (unsigned int x)
{
return (x << (u4) 15) << (u4) 15;
}
__attribute__ ((noipa))
unsigned int
reference (unsigned int x)
{
return x << 30;
}
int
main (void)
{
volatile unsigned int x = 1;
if (f (x) != reference (x))
__builtin_abort ();
return 0;
}
aborts on aarch64 even at -O0, though passes with Clang