https://gcc.gnu.org/g:6b635f84c4e973c873cf49f99d87b0fe22d3f5f5

commit r16-20-g6b635f84c4e973c873cf49f99d87b0fe22d3f5f5
Author: Dimitar Dimitrov <dimi...@dinux.eu>
Date:   Wed Jan 29 19:43:15 2025 +0200

    testsuite: Use int size instead of alignment for pr116357.c
    
    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 <dimi...@dinux.eu>

Diff:
---
 gcc/testsuite/gcc.dg/pr116357.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/pr116357.c b/gcc/testsuite/gcc.dg/pr116357.c
index 07effa132548..12aaf62c20d4 100644
--- a/gcc/testsuite/gcc.dg/pr116357.c
+++ b/gcc/testsuite/gcc.dg/pr116357.c
@@ -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" } */

Reply via email to