aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2023-05-23 14:30:53 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2023-05-30 15:47:32 +0000
commitd12d2aa4fccc76a9a08c8120c5e37d9cab8683e8 (patch)
tree4f63149139c65628b809371ea7c674abbf830671
parent45466eecf5ef669164c0922e5be8fd288b144886 (diff)
downloadgcc-d12d2aa4fccc76a9a08c8120c5e37d9cab8683e8.zip
gcc-d12d2aa4fccc76a9a08c8120c5e37d9cab8683e8.tar.gz
gcc-d12d2aa4fccc76a9a08c8120c5e37d9cab8683e8.tar.bz2
testsuite: make mve_intrinsic_type_overloads-int.c libc-agnostic
Glibc defines int32_t as 'int' while newlib defines it as 'long int'. Although these correspond to the same size, g++ complains when using the 'wrong' version: invalid conversion from 'long int*' to 'int32_t*' {aka 'int*'} [-fpermissive] or invalid conversion from 'int*' to 'int32_t*' {aka 'long int*'} [-fpermissive] when calling vst1q(int32*, int32x4_t) with a first parameter of type 'long int *' (resp. 'int *') To make this test pass with any type of toolchain, this patch defines 'word_type' according to which libc is in use. 2023-05-23 Christophe Lyon <christophe.lyon@linaro.org> gcc/testsuite/ * gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c: Support both definitions of int32_t.
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c
index 7947dc0..ab51cc8 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c
@@ -47,14 +47,22 @@ foo2 (short * addr, int16x8_t value)
vst1q (addr, value);
}
-void
-foo3 (int * addr, int32x4_t value)
-{
- vst1q (addr, value); /* { dg-warning "invalid conversion" "" { target c++ } } */
-}
+/* Glibc defines int32_t as 'int' while newlib defines it as 'long int'.
+
+ Although these correspond to the same size, g++ complains when using the
+ 'wrong' version:
+ invalid conversion from 'long int*' to 'int32_t*' {aka 'int*'} [-fpermissive]
+
+ The trick below is to make this test pass whether using glibc-based or
+ newlib-based toolchains. */
+#if defined(__GLIBC__)
+#define word_type int
+#else
+#define word_type long int
+#endif
void
-foo4 (long * addr, int32x4_t value)
+foo3 (word_type * addr, int32x4_t value)
{
vst1q (addr, value);
}
@@ -78,13 +86,7 @@ foo7 (unsigned short * addr, uint16x8_t value)
}
void
-foo8 (unsigned int * addr, uint32x4_t value)
-{
- vst1q (addr, value); /* { dg-warning "invalid conversion" "" { target c++ } } */
-}
-
-void
-foo9 (unsigned long * addr, uint32x4_t value)
+foo8 (unsigned word_type * addr, uint32x4_t value)
{
vst1q (addr, value);
}