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.

Committed as obvious.

        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 <dimi...@dinux.eu>
---
 gcc/testsuite/g++.dg/abi/nsdmi-aggr1a.C   | 2 +-
 gcc/testsuite/g++.dg/abi/nullptr-align2.C | 2 +-
 gcc/testsuite/g++.dg/cpp1z/aligned-new9.C | 2 +-
 gcc/testsuite/g++.dg/cpp2a/bit-cast5.C    | 6 +++---
 gcc/testsuite/g++.dg/pr53037-1.C          | 4 ++--
 gcc/testsuite/g++.dg/warn/Wpadded-1.C     | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/g++.dg/abi/nsdmi-aggr1a.C 
b/gcc/testsuite/g++.dg/abi/nsdmi-aggr1a.C
index e7a509dbc85..90526e894b3 100644
--- a/gcc/testsuite/g++.dg/abi/nsdmi-aggr1a.C
+++ b/gcc/testsuite/g++.dg/abi/nsdmi-aggr1a.C
@@ -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 {
diff --git a/gcc/testsuite/g++.dg/abi/nullptr-align2.C 
b/gcc/testsuite/g++.dg/abi/nullptr-align2.C
index 66a90119a15..0f18a9185d1 100644
--- a/gcc/testsuite/g++.dg/abi/nullptr-align2.C
+++ b/gcc/testsuite/g++.dg/abi/nullptr-align2.C
@@ -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 } } }
 };
diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C 
b/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C
index dc5cff6ea0c..00113900932 100644
--- a/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C
+++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C
@@ -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* } }
 
diff --git a/gcc/testsuite/g++.dg/cpp2a/bit-cast5.C 
b/gcc/testsuite/g++.dg/cpp2a/bit-cast5.C
index 9d536d15984..5d0d2b3e1b8 100644
--- a/gcc/testsuite/g++.dg/cpp2a/bit-cast5.C
+++ b/gcc/testsuite/g++.dg/cpp2a/bit-cast5.C
@@ -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;
 }
 
diff --git a/gcc/testsuite/g++.dg/pr53037-1.C b/gcc/testsuite/g++.dg/pr53037-1.C
index a3d8f99b54e..b8948c01611 100644
--- a/gcc/testsuite/g++.dg/pr53037-1.C
+++ b/gcc/testsuite/g++.dg/pr53037-1.C
@@ -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))); 
diff --git a/gcc/testsuite/g++.dg/warn/Wpadded-1.C 
b/gcc/testsuite/g++.dg/warn/Wpadded-1.C
index af375a4d055..e5bb6b9ab3a 100644
--- a/gcc/testsuite/g++.dg/warn/Wpadded-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wpadded-1.C
@@ -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;
 };
-- 
2.45.2

Reply via email to