https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126522
Bug ID: 126522
Summary: Wrong code with RTL ifcvt wrt alias sets
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
typedef int __attribute__((may_alias)) aint;
float gf;
int gi;
__attribute__((noipa)) int
f (void *p, int c, float v)
{
int x;
gf = v;
if (c)
x = *(aint *) p; /* c == 1: p == &gf, may_alias read of a float.
*/
else
x = *(int *) p; /* c == 0: p == &gi, plain read of an int. */
return x;
}
int
main (void)
{
/* Then arm. f stores 1.0f into gf and must read those bits back. */
gf = 0.0f;
int r1 = f (&gf, 1, 1.0f);
int expect = *(aint *) &gf; /* the bits of 1.0f */
if (r1 != expect)
__builtin_abort ();
/* Else arm, so that both sides of the diamond really run. */
gf = 0.0f;
gi = 77;
if (f (&gi, 0, 2.0f) != 77)
__builtin_abort ();
return 0;
}
on aarch64 at -O2 -fno-code-hoisting -fno-ssa-phiopt aborts and passes at -O0