https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91322

--- Comment #11 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The problem is that on ARM sizeof (short) == sizeof (int)
and LTO will glob all short and int pointers together.  So this is missed
optimization only.

We do this globing sort of by design. For GCC11 I plan to refine type merging
again a bit but until then we could either xfail this testcase or change int to
long which is 4 bytes.

Not a release blocker though.

I would welcome if someone could test the testcase adjustment (I was doing LTO
by hand)

diff --git a/gcc/testsuite/g++.dg/lto/alias-4_0.C
b/gcc/testsuite/g++.dg/lto/alias-4_0.C
index 410c3140baf..0ab12adef5b 100644
--- a/gcc/testsuite/g++.dg/lto/alias-4_0.C
+++ b/gcc/testsuite/g++.dg/lto/alias-4_0.C
@@ -5,7 +5,7 @@ short *ptr_init, **ptr=&ptr_init;

 __attribute__ ((used))
 struct a {
-  int *aptr;
+  long *aptr;
 } a, *aptr=&a;

 void

Reply via email to