]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Fix c-c++-common/auto-init-* tests
authorJakub Jelinek <jakub@redhat.com>
Sat, 11 Sep 2021 11:48:52 +0000 (13:48 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sat, 11 Sep 2021 11:48:52 +0000 (13:48 +0200)
> > 2021-08-20  qing zhao  <qing.zhao@oracle.com>
> >
> >        * c-c++-common/auto-init-1.c: New test.
> >        * c-c++-common/auto-init-10.c: New test.
> >        * c-c++-common/auto-init-11.c: New test.
> >        * c-c++-common/auto-init-12.c: New test.
> >        * c-c++-common/auto-init-13.c: New test.
> >        * c-c++-common/auto-init-14.c: New test.
> >        * c-c++-common/auto-init-15.c: New test.
> >        * c-c++-common/auto-init-16.c: New test.
> >        * c-c++-common/auto-init-2.c: New test.
> >        * c-c++-common/auto-init-3.c: New test.
> >        * c-c++-common/auto-init-4.c: New test.
> >        * c-c++-common/auto-init-5.c: New test.
> >        * c-c++-common/auto-init-6.c: New test.
> >        * c-c++-common/auto-init-7.c: New test.
> >        * c-c++-common/auto-init-8.c: New test.
> >        * c-c++-common/auto-init-9.c: New test.
> >        * c-c++-common/auto-init-esra.c: New test.
> >        * c-c++-common/auto-init-padding-1.c: New test.
> >        * c-c++-common/auto-init-padding-2.c: New test.
> >        * c-c++-common/auto-init-padding-3.c: New test.

This fails on many targets, e.g. i686-linux or x86_64-linux with -m32.

The main problem is hardcoding type sizes and structure layout expectations
that are valid only on some lp64 targets.
On ilp32 long and pointer are 32-bit, and there are targets that are neither
ilp32 nor lp64 and there even other sizes can't be taken for granted.
Also, long double depending on target and options is either 8, 12 or 16 byte
(the first one when it is the same as double, the second e.g. for ia32
extended long double (which is under the hood 10 byte), the last either
the same hw type on x86_64 or IBM double double or IEEE quad).
In the last test, one problem is that unsigned long is on ilp32 32-bit
instead of 64-bit, but even just changing to long long is not enough,
as long long in structures on ia32 is only 4 byte aligned instead of 8.

Tested on x86_64-linux -m32/-m64, ok for trunk?

Note, the gcc.dg/i386/auto-init* tests fail also, just don't have time to
deal with that right now, just try
make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} i386.exp=auto-init*'
Guess some of those tests should be restricted to lp64 in there, others
where it might be easier to check all of lp64, x32 and ia32 code generation
could have different matches.  Wonder also about the aarch64 tests, there is
also -mabi=ilp32...
+FAIL: gcc.target/i386/auto-init-2.c scan-rtl-dump-times expand "0xfefefefefefefefe" 3
+FAIL: gcc.target/i386/auto-init-2.c scan-rtl-dump-times expand "0xfffffffffefefefe" 2
+FAIL: gcc.target/i386/auto-init-3.c scan-assembler-times pxor\\t\\\\%xmm0, \\\\%xmm0 3
+FAIL: gcc.target/i386/auto-init-4.c scan-rtl-dump-times expand "0xfffffffffefefefe" 1
+FAIL: gcc.target/i386/auto-init-4.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-4.c scan-rtl-dump-times expand "\\\\[0xfefefefefefefefe\\\\]" 1
+FAIL: gcc.target/i386/auto-init-5.c scan-assembler-times \\\\.long\\t0 14
+FAIL: gcc.target/i386/auto-init-6.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 2
+FAIL: gcc.target/i386/auto-init-6.c scan-rtl-dump-times expand "\\\\[0xfefefefefefefefe\\\\]" 1
+FAIL: gcc.target/i386/auto-init-7.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 2
+FAIL: gcc.target/i386/auto-init-7.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\)\\\\)" 3
+FAIL: gcc.target/i386/auto-init-8.c scan-rtl-dump-times expand "0xfffffffffefefefe" 1
+FAIL: gcc.target/i386/auto-init-8.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 2
+FAIL: gcc.target/i386/auto-init-8.c scan-rtl-dump-times expand "\\\\[0xfefefefefefefefe\\\\]" 2
+FAIL: gcc.target/i386/auto-init-padding-1.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-10.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-11.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-12.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-2.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-3.c scan-assembler movl\\t\\\\\$16,
+FAIL: gcc.target/i386/auto-init-padding-3.c scan-assembler rep stosq
+FAIL: gcc.target/i386/auto-init-padding-4.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-5.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-6.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
+FAIL: gcc.target/i386/auto-init-padding-7.c scan-assembler-times movq\\t\\\\\$0, 2
+FAIL: gcc.target/i386/auto-init-padding-8.c scan-assembler-times movq\\t\\\\\$0, 2
+FAIL: gcc.target/i386/auto-init-padding-9.c scan-assembler rep stosq

2021-09-11  Jakub Jelinek  <jakub@redhat.com>

* c-c++-common/auto-init-1.c: Enable test only on ilp32 or lp64
targets, expect different long and pointer sizes between ilp32 and
lp64.
* c-c++-common/auto-init-2.c: Likewise.
* c-c++-common/auto-init-3.c: Expect one of the common long double
sizes (8/12/16 bytes) instead of hardcoding 16 bytes.
* c-c++-common/auto-init-4.c: Likewise.
* c-c++-common/auto-init-5.c: Expect one of the common
_Complex long double sizes (16/24/32 bytes) instead of hardcoding 32
bytes.
* c-c++-common/auto-init-6.c: Likewise.
* c-c++-common/auto-init-padding-1.c: Enable test only on ilp32 or lp64
targets.
(struct test_small_hole): Change type of four to unsigned long long
and add aligned attribute.

gcc/testsuite/c-c++-common/auto-init-1.c
gcc/testsuite/c-c++-common/auto-init-2.c
gcc/testsuite/c-c++-common/auto-init-3.c
gcc/testsuite/c-c++-common/auto-init-4.c
gcc/testsuite/c-c++-common/auto-init-5.c
gcc/testsuite/c-c++-common/auto-init-6.c
gcc/testsuite/c-c++-common/auto-init-padding-1.c

index 8b8ba3dd7e8d4828aa692fc7323a7972490bf90d..84ba0a90d45a2a98743bcdbf834ac9e421e9a11c 100644 (file)
@@ -1,5 +1,5 @@
 /* Verify zero initialization for integer and pointer type automatic variables.  */
-/* { dg-do compile } */
+/* { dg-do compile { target { ilp32 || lp64 } } } */
 /* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
 
 #ifndef __cplusplus
@@ -33,7 +33,9 @@ void foo()
 /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
 /* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
 /* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */
index 71955b54ba031722ec9fb4b4b4535d6ef3082a55..69768d6451da239fe6377a1611aa931793851935 100644 (file)
@@ -1,5 +1,5 @@
 /* Verify pattern initialization for integer and pointer type automatic variables.  */
-/* { dg-do compile } */
+/* { dg-do compile { target { ilp32 || lp64 } } } */
 /* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
 
 #ifndef __cplusplus
@@ -33,7 +33,9 @@ void foo()
 /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
 /* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
 /* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */
index 312275666381de4f32c17f403a28246620bf57cf..062d60c1631e40ad904c40899118299ec11fe620 100644 (file)
@@ -16,4 +16,4 @@ long double foo()
 
 /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, 0\\)" "gimple" } } */
index 15a431726dcd9c5f9c53ddcbdc67e698dd964d1f..9d8f23ed4e333c33b7a88e40ad58e5b3fcdcd24a 100644 (file)
@@ -16,4 +16,4 @@ long double foo()
 
 /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, 0\\)" "gimple" } } */
index 54f90bc890b5ff21214ac92c8f9c84887762c697..9c98a6e7ab2ac35bc72e21ffbef44c133c69306a 100644 (file)
@@ -17,5 +17,5 @@ _Complex long double foo()
 
 /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(32, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, 0\\)" "gimple" } } */
 
index 4124a2b183aad7477f143a014a5708fd2a03b8bf..3fe24562ebb37e4f4c90f3fa1baf3c7e85220e71 100644 (file)
@@ -17,5 +17,5 @@ _Complex long double foo()
 
 /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
 /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(32, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, 0\\)" "gimple" } } */
 
index 97f78ee7d56ac59abee4658452cf8911f6399f3d..83db8dde8324a0a705c7a9216fb7680dab017388 100644 (file)
@@ -1,6 +1,6 @@
 /* Verify the padding initialization for pattern initialization, we always emit
  * a call to __builtin_clear_padding to initialize the paddings to zero.  */
-/* { dg-do compile } */
+/* { dg-do compile { target { ilp32 || lp64 } } } */
 /* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
 
 
@@ -9,7 +9,7 @@ struct test_small_hole {
   char two;
   /* 3 byte padding hole here. */
   int three;
-  unsigned long four;
+  unsigned long long four __attribute__((aligned (8)));
 };
 
 extern void g (struct test_small_hole);