diff mbox

Fix builtin-arith-overflow-1.c with unsigned char

Message ID 39455897.GdEK13GK1O@polaris
State New
Headers show

Commit Message

Eric Botcazou Dec. 11, 2014, 10:13 p.m. UTC
The char's in gcc.dg/builtin-arith-overflow-1.c are almost all explicitly 
signed or unsigned, except for 2 of them, but that's enough to make it fail 
for targets whose char is unsigned.

Tested on x86-64 and a private port, applied on mainline as obvious.


2014-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/builtin-arith-overflow-1.c (fn2): Take signed char.
	(fn3): Likewise.
diff mbox

Patch

Index: gcc.dg/builtin-arith-overflow-1.c
===================================================================
--- gcc.dg/builtin-arith-overflow-1.c	(revision 218617)
+++ gcc.dg/builtin-arith-overflow-1.c	(working copy)
@@ -17,7 +17,7 @@  fn1 (int x, unsigned int y)
 /* MUL_OVERFLOW should be folded into unsigned multiplication,
    because ovf is never used.  */
 __attribute__((noinline, noclone)) int
-fn2 (char x, long int y)
+fn2 (signed char x, long int y)
 {
   short int res;
   int ovf = __builtin_mul_overflow (x, y, &res);
@@ -31,7 +31,7 @@  fn2 (char x, long int y)
 /* ADD_OVERFLOW should be folded into unsigned addition,
    because it never overflows.  */
 __attribute__((noinline, noclone)) int
-fn3 (char x, unsigned short y, int *ovf)
+fn3 (signed char x, unsigned short y, int *ovf)
 {
   int res;
   *ovf = __builtin_add_overflow (x, y, &res);