diff mbox

Fix PR70941

Message ID 20160506152548.GP26501@tucnak.zalov.cz
State New
Headers show

Commit Message

Jakub Jelinek May 6, 2016, 3:25 p.m. UTC
On Fri, May 06, 2016 at 09:37:46AM +0200, Richard Biener wrote:
> 
> The following completes the fix for PR67921 now that we have a testcase
> for the non-pointer case.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

The testcase (for obvious reasons) fails on -funsigned-char defaulting
targets.  Plus, just theoretically, if int is 32-bits or larger, but
char is not 8-bit, it could fail as well.

Fixed thusly, committed as obvious.

2016-05-06  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/70941
	* gcc.dg/torture/pr70941.c (abort): Remove prototype.
	(a, b, c, d): Change type from char to signed char.
	(main): Compare against (signed char) -1634678893 instead of
	hardcoded -109.  Use __builtin_abort instead of abort.



	Jakub
diff mbox

Patch

--- gcc/testsuite/gcc.dg/torture/pr70941.c.jj	2016-05-06 15:09:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/torture/pr70941.c	2016-05-06 17:11:25.000000000 +0200
@@ -1,14 +1,12 @@ 
 /* { dg-do run } */
 /* { dg-require-effective-target int32plus } */
 
-extern void abort (void);
-
-char a = 0, b = 0, c = 0, d = 0;
+signed char a = 0, b = 0, c = 0, d = 0;
 
 int main()
 {
   a = -(b - 405418259) - ((d && c) ^ 2040097152);
-  if (a != -109)
-    abort();
+  if (a != (signed char) -1634678893)
+    __builtin_abort ();
   return 0;
 }