https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126747
Bug ID: 126747
Summary: aarch64: wrong code with -Os
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: kristerw at gcc dot gnu.org
Blocks: 118443
Target Milestone: ---
Target: aarch64-unknown-linux-gnu
The test below fails when compiled for AArch64 with -Os:
volatile int c[2];
[[gnu::noipa]] int
foo (unsigned x, unsigned y)
{
unsigned r = x * y;
int t = 0;
if (c[0]) { int u = 0; if (x != 0) u = (r / x != y); t += u; }
if (c[1]) { int u = 0; if (x != 0) u = (r / x != y); t += u; }
return t;
}
int main()
{
c[0] = 1;
c[1] = 1;
if (foo(1,1))
__builtin_abort();
return 0;
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing