diff mbox series

testsuite: Fix up pr107541.c test

Message ID Y2pCbby26nP6ipNf@tucnak
State New
Headers show
Series testsuite: Fix up pr107541.c test | expand

Commit Message

Jakub Jelinek Nov. 8, 2022, 11:50 a.m. UTC
On Mon, Nov 07, 2022 at 12:42:38PM +0100, Aldy Hernandez via Gcc-patches wrote:
> 	* gcc.dg/tree-ssa/pr107541.c: New test.

The test fails when long is 32-bit rather than 64-bit (say x86_64 with
RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} tree-ssa.exp=pr107541.c'
).
I've tweaked it to use long long so it passes even on the 32-bit
targets, and added an early out for weirdo targets because I think
the test assumes the usual 1/2/4/8 bytes sizes for char/short/int/long long.

Tested on x86_64-linux, ok for trunk?

2022-11-08  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/107541
	* gcc.dg/tree-ssa/pr107541.c (c): Use long long type rather than long.
	(main): Punt if sizeof short isn't 2, or int 4, or long long 8.



	Jakub

Comments

Jeff Law Nov. 13, 2022, 12:15 a.m. UTC | #1
On 11/8/22 04:50, Jakub Jelinek via Gcc-patches wrote:
> On Mon, Nov 07, 2022 at 12:42:38PM +0100, Aldy Hernandez via Gcc-patches wrote:
>> 	* gcc.dg/tree-ssa/pr107541.c: New test.
> The test fails when long is 32-bit rather than 64-bit (say x86_64 with
> RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} tree-ssa.exp=pr107541.c'
> ).
> I've tweaked it to use long long so it passes even on the 32-bit
> targets, and added an early out for weirdo targets because I think
> the test assumes the usual 1/2/4/8 bytes sizes for char/short/int/long long.
>
> Tested on x86_64-linux, ok for trunk?
>
> 2022-11-08  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR tree-optimization/107541
> 	* gcc.dg/tree-ssa/pr107541.c (c): Use long long type rather than long.
> 	(main): Punt if sizeof short isn't 2, or int 4, or long long 8.

OK

jeff
diff mbox series

Patch

--- gcc/testsuite/gcc.dg/tree-ssa/pr107541.c.jj	2022-11-07 15:12:24.519022064 +0100
+++ gcc/testsuite/gcc.dg/tree-ssa/pr107541.c	2022-11-08 12:45:12.926718243 +0100
@@ -3,9 +3,11 @@ 
 
 unsigned char a = 1;
 char b, e;
-long c;
+long long c;
 short d;
 int main() {
+  if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
+    return 0;
   a = ~(1 && a);
   c = ~((~a / 8 | -2) & 11007578330939886389LLU);
   e = -c;