]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite/108604 - gcc.dg/torture/pr108574-3.c hangs on unsigned char archs
authorXianmiao Qu <cooper.qu@linux.alibaba.com>
Tue, 31 Jan 2023 08:49:06 +0000 (09:49 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 31 Jan 2023 08:50:40 +0000 (09:50 +0100)
In the architecture where sign defaults to unsigned, the 'f' will be zero
extended to int type in the expression 'd = ~(f & ~2880764155)', then the
'd' will become -1 wich cause the case to fail.
So it's ok for the architectures where sign defaults to signed like x86,
but failed for the architectures where sign defaults to unsigned like arm
and csky. Change char to signed char to avoid this problem.

PR testsuite/108604
gcc/testsuite:
* gcc.dg/torture/pr108574-3.c (b, f): Change type from char to
signed char.

gcc/testsuite/gcc.dg/torture/pr108574-3.c

index 3c9146e31ac86c67b2d38b733b72bfa9a8fea40d..b4d5dae9f80dd9cdd842dd565378523792ac8ffc 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 
 int a = 3557301289, d;
-char b, f;
+signed char b, f;
 unsigned short c = 241;
 short e, g;
 static void h() {