[Bug target/97161] New: [8/9/10/11 Regression] aarch64: Wrong code at -O2/-O3 since r8-4308-g13494fcb3
acoplan at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 22 09:46:49 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97161
Bug ID: 97161
Summary: [8/9/10/11 Regression] aarch64: Wrong code at -O2/-O3
since r8-4308-g13494fcb3
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
For the following C program:
__attribute__ ((noinline))
void f(char *p, char x)
{
if (x != 1)
__builtin_abort();
}
union {
char a;
int b;
short c;
} d;
short g, *e = &d.c;
int i;
int main()
{
int *h = &d.b;
g = *h = 1;
*e |= i;
f(0, d.a);
}
GCC generates wrong code (and abort is called) at -O2 on AArch64 after
r8-4308-g13494fcb363e8a901db7768a851a9eed1dea62e3.
The issue goes away with -fno-strict-aliasing, but I believe this program does
not violate the strict aliasing constraints: we're simply accessing each member
of the union by its given type.
GCC trunk (x86) and clang 10 (x86 and aarch64) at -O{0,1,2,3} all produce a
program that exits cleanly.
To reproduce, on AArch64:
$ gcc test.c
$ ./a.out
$ gcc test.c -O2
$ ./a.out
Aborted (core dumped)
More information about the Gcc-bugs
mailing list