diff mbox series

testsuite: Fix pr115278.cc test when uint32_t isn't unsigned int

Message ID 20240703232338.242993-1-thiago.bauermann@linaro.org
State New
Headers show
Series testsuite: Fix pr115278.cc test when uint32_t isn't unsigned int | expand

Commit Message

Thiago Jung Bauermann July 3, 2024, 11:23 p.m. UTC
On arm-none-eabi, g++.dg/vect/pr115278.cc fails with:

FAIL: g++.dg/vect/pr115278.cc  -std=c++14 (test for excess errors)
Excess errors:
/path/to/gcc.git/gcc/testsuite/g++.dg/vect/pr115278.cc:24:28: error: invalid conversion from 'volatile unsigned int*' to 'volatile uint32_t*' {aka 'volatile long unsigned int*'} [-fpermissive]

g++.dg/vect/pr115278.cc  -std=c++14 : dump file does not exist
UNRESOLVED: g++.dg/vect/pr115278.cc  -std=c++14  scan-tree-dump-times optimized "\\*WRITE[^\r\n]* ={v} " 2

The problem is that the cast used to initialize the WRITE variable
doesn't match the underlying type of uint32_t.  Fix by using
__UINT32_TYPE__ instead.

Verified that after this change, the test still fails when reverting the
fix for PR115278.

Tested on:
- Host x86_64-linux-gnu, target arm-unknown-eabi
- Native armv8l-linux-gnueabihf
- Native aarch64-linux-gnu
- Native x86_64-linux-gnu

gcc/testsuite/
	* g++.dg/vect/pr115278.cc: Use __UINT32_TYPE__ in cast used to
	initialize WRITE.
---
 gcc/testsuite/g++.dg/vect/pr115278.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thiago Jung Bauermann July 3, 2024, 11:38 p.m. UTC | #1
Thiago Jung Bauermann <thiago.bauermann@linaro.org> writes:

> --- a/gcc/testsuite/g++.dg/vect/pr115278.cc
> +++ b/gcc/testsuite/g++.dg/vect/pr115278.cc
> @@ -2,6 +2,7 @@
>  // { dg-require-effective-target c++11 }
>  // { dg-additional-options "-fdump-tree-optimized" }
>  
> +#include <climits>
>  #include <cstdint>
>  
>  const int runs = 92;

Sorry, the new include isn't necessary. It's a leftover from a previous
version of the patch.

I removed it locally and if the patch is approved, I'll commit it
without this hunk.
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/vect/pr115278.cc b/gcc/testsuite/g++.dg/vect/pr115278.cc
index 331075fb2781..39a7537a3e6a 100644
--- a/gcc/testsuite/g++.dg/vect/pr115278.cc
+++ b/gcc/testsuite/g++.dg/vect/pr115278.cc
@@ -2,6 +2,7 @@ 
 // { dg-require-effective-target c++11 }
 // { dg-additional-options "-fdump-tree-optimized" }
 
+#include <climits>
 #include <cstdint>
 
 const int runs = 92;
@@ -21,7 +22,7 @@  union BitfieldStructUnion {
         BitfieldStructUnion(uint32_t value_low, uint32_t value_high) : value_low(value_low), value_high(value_high) {}
 };
 
-volatile uint32_t *WRITE = (volatile unsigned*)0x42;
+volatile uint32_t *WRITE = (volatile __UINT32_TYPE__*)0x42;
 
 void buggy() {
         for (int i = 0; i < runs; i++) {