]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add filters for default_packed targets [PR116155]
authorDimitar Dimitrov <dimitar@dinux.eu>
Tue, 30 Jul 2024 20:08:38 +0000 (23:08 +0300)
committerDimitar Dimitrov <dimitar@dinux.eu>
Thu, 1 Aug 2024 14:57:32 +0000 (17:57 +0300)
A few recent C++ test cases are assuming non-zero structure field
padding.  Consequently they fail for targets defaulting to packed
structure layout.  Fix by adding the necessary DejaGnu filters.

There are no test result changes for x86_64-pc-linux-gnu:
  $ dg-cmp-results.sh -v -v "" pre-g++.sum post-g++.sum
  -> No differences.

The tests for pru-unknown-elf changed from FAIL to UNSUPPORTED.

PR testsuite/116155

gcc/testsuite/ChangeLog:

* g++.dg/abi/nsdmi-aggr1a.C: Disable test for effective
default_packed targets.
* g++.dg/abi/nullptr-align2.C: Ignore warning for default_packed
targets.
* g++.dg/cpp1z/aligned-new9.C: Disable test for effective
default_packed targets.
* g++.dg/cpp2a/bit-cast5.C: Ignore dg-error for default_packed
targets.
* g++.dg/pr53037-1.C: Match any default packing value.
* g++.dg/warn/Wpadded-1.C: Ignore warning for default_packed
targets.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
gcc/testsuite/g++.dg/abi/nsdmi-aggr1a.C
gcc/testsuite/g++.dg/abi/nullptr-align2.C
gcc/testsuite/g++.dg/cpp1z/aligned-new9.C
gcc/testsuite/g++.dg/cpp2a/bit-cast5.C
gcc/testsuite/g++.dg/pr53037-1.C
gcc/testsuite/g++.dg/warn/Wpadded-1.C

index e7a509dbc8583d2c77d924a70d14afd51772d82e..90526e894b334c173c99348892de57acacc53786 100644 (file)
@@ -1,5 +1,5 @@
 // PR c++/103681
-// { dg-do compile { target c++11 } }
+// { dg-do compile { target { { c++11 } && { ! default_packed } } } }
 // { dg-additional-options "-fabi-version=0 -Wabi=16" }
 
 struct A {
index 66a90119a15eb7f00d2d5edcd17226114f715b44..0f18a9185d1acb39405d36f14dc13f13d189b9c5 100644 (file)
@@ -16,5 +16,5 @@ struct B
 struct C
 {
   char c;
-  decltype(nullptr) n;         // { dg-warning "alignment" }
+  decltype(nullptr) n;         // { dg-warning "alignment" "" { target { ! default_packed } } }
 };
index dc5cff6ea0c150887f2faa66bdfdcfd9fb1749d0..0011390093281b718b913969046f9920077b3c1c 100644 (file)
@@ -1,5 +1,5 @@
 // PR c++/102071
-// { dg-do run { target c++17 } }
+// { dg-do run  { target { { c++17 } && { ! default_packed } } } }
 // { dg-additional-options -faligned-new=2 }
 // { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
 
index 9d536d1598403bfa45b6308870ed35ca116a4504..5d0d2b3e1b8d9100627b48ca638f116072b13104 100644 (file)
@@ -21,7 +21,7 @@ f2 ()
 {
   A a;
   a.a = 1; a.b = 2; a.c = 3; a.e = 4; a.f = 5;
-  C b = __builtin_bit_cast (C, a);     // { dg-error "'__builtin_bit_cast' accessing uninitialized byte at offset 3" }
+  C b = __builtin_bit_cast (C, a);     // { dg-error "'__builtin_bit_cast' accessing uninitialized byte at offset 3" "" { target { ! default_packed } } }
   return false;
 }
 
@@ -48,7 +48,7 @@ f5 ()
 {
   D a;
   a.b = 1;
-  E b = __builtin_bit_cast (E, a);     // { dg-error "'__builtin_bit_cast' accessing uninitialized byte at offset 3" }
+  E b = __builtin_bit_cast (E, a);     // { dg-error "'__builtin_bit_cast' accessing uninitialized byte at offset 3" "" { target { ! default_packed } } }
   return false;
 }
 
@@ -57,7 +57,7 @@ f6 ()
 {
   D a;
   a.c = 1;
-  E b = __builtin_bit_cast (E, a);     // { dg-error "'__builtin_bit_cast' accessing uninitialized byte at offset 2" }
+  E b = __builtin_bit_cast (E, a);     // { dg-error "'__builtin_bit_cast' accessing uninitialized byte at offset 2" "" { target { ! default_packed } } }
   return false;
 }
 
index a3d8f99b54e2e8c0d5b5cc2e543f933650827cc9..b8948c0161186c1d1ae53ceaa79407c768cb7fb0 100644 (file)
@@ -35,7 +35,7 @@ struct foo4
   __u64 x;
 } __attribute__((aligned(8)));
 
-struct foo5 /* { dg-warning "alignment 4 of 'foo5' is less than 16" } */
+struct foo5 /* { dg-warning "alignment \[0-9\]+ of 'foo5' is less than 16" } */
 {
   int i1;
   int x __attribute__((warn_if_not_aligned(16))); /* { dg-warning "'foo5::x' offset 4 in 'foo5' isn't aligned to 16" } */
@@ -68,7 +68,7 @@ union bar2
   __u64 x;
 } __attribute__((aligned(8)));
 
-union bar3 /* { dg-warning "alignment 4 of 'bar3' is less than 16" } */
+union bar3 /* { dg-warning "alignment \[0-9\]+ of 'bar3' is less than 16" } */
 {
   int i1;
   int x __attribute__((warn_if_not_aligned(16))); 
index af375a4d055df5ffbaa9f93509882112e366c729..e5bb6b9ab3acd02c3a33d329a90310ea6f50daf0 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-options "-Wpadded" }
 
 template <class> struct A;
-template <typename> struct B { // { dg-warning "padding struct size to alignment boundary" }
+template <typename> struct B { // { dg-warning "padding struct size to alignment boundary"  "" { target { ! default_packed } } }
   long long _M_off;
   char _M_state;
 };