testsuite: Mark extra warnings for default_packed
authorDimitar Dimitrov <dimitar@dinux.eu>
Sat, 14 May 2022 18:40:11 +0000 (21:40 +0300)
committerDimitar Dimitrov <dimitar@dinux.eu>
Sat, 21 May 2022 18:27:28 +0000 (21:27 +0300)
If the target uses packed structs by default, there are no trailing
padding bytes allocated.  Hence extra warnings are emitted.

gcc/testsuite/ChangeLog:

* gcc.dg/Warray-bounds-48-novec.c: Add expected warnings
if target packs the structs by default.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c

index da179a2..5cae856 100644 (file)
@@ -238,15 +238,17 @@ static void warn_a1_init (struct A1 *p)
 
 static void warn_a1_local_buf (struct A1 *p)
 {
-  p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3;
+  p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2;
 
+  p->a1[3] = 3;            // { dg-warning "\\\[-Warray-bounds" "" { target default_packed } }
   p->a1[4] = 4;     // { dg-warning "\\\[-Warray-bounds" }
 }
 
 static void warn_a1_extern_buf (struct A1 *p)
 {
-  p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3; p->a1[4] = 4;
+  p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3;
 
+  p->a1[4] = 4;            // { dg-warning "\\\[-Warray-bounds" "" { target default_packed } }
   p->a1[5] = 5;     // { dg-warning "\\\[-Warray-bounds" }
 }