]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Use int size instead of alignment for pr116357.c
authorDimitar Dimitrov <dimitar@dinux.eu>
Wed, 29 Jan 2025 17:43:15 +0000 (19:43 +0200)
committerDimitar Dimitrov <dimitar@dinux.eu>
Fri, 18 Apr 2025 14:53:14 +0000 (17:53 +0300)
The test case assumes that alignof(int)=sizeof(int).  But for some
targets this is not valid.  For example, for PRU target,
alignof(int)=1 but sizeof(int)=4.

Fix the test case to align to twice the size of int, as the expected
dg-error messages suggest.

This patch fixes the test failures for PRU target.

gcc/testsuite/ChangeLog:

* gcc.dg/pr116357.c: Use sizeof(int) instead of alignof(int).

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
gcc/testsuite/gcc.dg/pr116357.c

index 07effa13254825abc8ffea326a3e3bb8aa191ab5..12aaf62c20d440d58e22dbad29ecfa7b1f1afc44 100644 (file)
@@ -2,9 +2,9 @@
 /* { dg-do compile } */
 /* { dg-options "" } */
 
-typedef int A __attribute__((aligned (2 * alignof (int))));
+typedef int A __attribute__((aligned (2 * sizeof (int))));
 A a[4];        /* { dg-error "alignment of array elements is greater than element size" } */
-typedef volatile int B __attribute__((aligned (2 * alignof (int))));
+typedef volatile int B __attribute__((aligned (2 * sizeof (int))));
 B b[4];        /* { dg-error "alignment of array elements is greater than element size" } */
-typedef const int C __attribute__((aligned (2 * alignof (int))));
+typedef const int C __attribute__((aligned (2 * sizeof (int))));
 C c[4];        /* { dg-error "alignment of array elements is greater than element size" } */