Message ID | 7e1a2db3-4cb7-8297-080b-41104f3e9682@suse.cz |
---|---|
State | New |
Headers | show |
Series | Add tests for resolved PR (PR c/85870). | expand |
On Fri, Mar 08, 2019 at 03:03:07PM +0100, Martin Liška wrote: > I'm going to install Jakub's test-case for a PR that's fixed > on trunk. This fails on i686-linux regtest when linker plugin is disabled (I use that in my setup, because my ld is 64-bit and 32-bit plugins don't really work very well with 64-bit linker). The problem is that XYZ is extern in both sources, no idea why it actually works with linker plugin. That said, dropping extern from one of the two doesn't really work, the ICE when the fix is reverted goes away. But with the following change the ICE is still in there when r268789 and r268981 is reverted (both in this i686-linux setup and normal x86_64-linux with linker plugin), and with vanilla cc1/lto1 works. So, I've committed this to trunk as obvious. 2019-03-08 Jakub Jelinek <jakub@redhat.com> PR c/85870 * gcc.dg/lto/pr85870_0.c: Add dg-extra-ld-options with -r -nostdlib -flinker-output=nolto-rel. --- gcc/testsuite/gcc.dg/lto/pr85870_0.c.jj 2019-03-08 21:43:52.032655832 +0100 +++ gcc/testsuite/gcc.dg/lto/pr85870_0.c 2019-03-08 23:25:15.150784557 +0100 @@ -1,6 +1,7 @@ /* PR c/85870 */ /* { dg-lto-do link } */ /* { dg-lto-options { { -flto -O2 } } } */ +/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */ typedef struct abc_s { char a1; Jakub
diff --git a/gcc/testsuite/gcc.dg/lto/pr85870_0.c b/gcc/testsuite/gcc.dg/lto/pr85870_0.c new file mode 100644 index 00000000000..4b59f607ebd --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr85870_0.c @@ -0,0 +1,34 @@ +/* PR c/85870 */ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -O2 } } } */ + +typedef struct abc_s { + char a1; + short a2; + unsigned int a3; + unsigned int a4; +} abc; + +typedef struct xyz_s { + unsigned x1; + unsigned x2; + abc *x3; +} xyz; + +extern xyz XYZ[3]; +static const abc Arr1[]={ + {0,0,0xdeadbeaf,0xbeefdead} , +#line 1040 + {0,0,0xdeadbeaf,0xbeefdead} }; + +void init_xyz_0() { + XYZ[0].x1=975753; + XYZ[0].x2=1024; + XYZ[0].x3=(abc *)Arr1; + +} + +int +main () +{ +} diff --git a/gcc/testsuite/gcc.dg/lto/pr85870_1.c b/gcc/testsuite/gcc.dg/lto/pr85870_1.c new file mode 100644 index 00000000000..cd1cd310164 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr85870_1.c @@ -0,0 +1,27 @@ +typedef struct abc_s { + char a1; + short a2; + unsigned int a3; + unsigned int a4; +} abc; + + +typedef struct xyz_s { + unsigned int x1; + unsigned int x2; + abc *x3; +} xyz; + + +extern xyz XYZ[3]; +static const abc Arr2[]={ + {0,0,0xbeafdead,0xdeadbeef} , +#line 1048594 + {0,0,0xbeafdead,0xdeadbeef} }; + +void init_xyz_1() { + XYZ[1].x1=425753; + XYZ[1].x2=1048576; + XYZ[1].x3=(abc *)Arr2; + +}