]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gomp: testsuite: improve compatibility of bad-array-section-3.c [PR113428]
authorRichard Earnshaw <rearnsha@arm.com>
Wed, 6 Mar 2024 13:41:02 +0000 (13:41 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Mon, 11 Mar 2024 15:51:35 +0000 (15:51 +0000)
This test generates different warnings on ilp32 targets because the size
of an integer matches the size of a pointer.  Avoid this by using
signed char.

gcc/testsuite:

PR testsuite/113428
* gcc.dg/gomp/bad-array-section-c-3.c: Use signed char instead
of int.

gcc/testsuite/gcc.dg/gomp/bad-array-section-c-3.c

index 8be15ced8c067bc8331587f3117c0ebb56cee6cc..431af71c42224470dc9e9884a027934b13d1be8a 100644 (file)
@@ -1,15 +1,15 @@
 /* { dg-do compile } */
 
 struct S {
-  int *ptr;
+  signed char *ptr;
 };
 
 int main()
 {
-  int arr[20];
+  signed char arr[20];
 
   /* Reject array section in compound initialiser.  */
-#pragma omp target map( (struct S) { .ptr = (int *) arr[5:5] } )
+#pragma omp target map( (struct S) { .ptr = (signed char *) arr[5:5] } )
 /* { dg-error {expected '\]' before ':' token} "" { target *-*-* } .-1 } */
 /* { dg-warning {cast to pointer from integer of different size} "" { target *-*-* } .-2 } */
 /* { dg-message {sorry, unimplemented: unsupported map expression} "" { target *-*-* } .-3 } */