diff mbox

[testsuite] Fix bogus pr31096-1.c failure for avr

Message ID 877f7mjzpr.fsf@atmel.com
State New
Headers show

Commit Message

Senthil Kumar Selvaraj Nov. 29, 2016, 11:27 a.m. UTC
Hi,

  This patch fixes a bogus testsuite failure (gcc.dg/pr31096-1.c) for
  the avr target.

  The dump expects constants which would only be present if the target's
  int size is 32 bits.

  Fixed by explicitly using 32 bit ints for targets with __SIZEOF_INT__
  < 4. Committed to trunk as obvious.

Regards
Senthil


gcc/testsuite/ChangeLog

2016-11-29  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

        * testsuite/gcc.dg/pr31096-1.c: Use __{U,}INT32_TYPE__ for
        targets with sizeof(int) < 4.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/pr31096-1.c
===================================================================
--- gcc/testsuite/gcc.dg/pr31096-1.c    (revision 242953)
+++ gcc/testsuite/gcc.dg/pr31096-1.c    (revision 242954)
@@ -2,8 +2,16 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-optimized" } */
 
+#if __SIZEOF_INT__ < 4
+  __extension__ typedef __INT32_TYPE__  int32_t;
+  __extension__ typedef __UINT32_TYPE__ uint32_t;
+#else
+  typedef int int32_t;
+  typedef unsigned uint32_t;
+#endif
+
 #define zero(name, op) \
-int name (int a, int b) \
+int32_t name (int32_t a, int32_t b) \
 { return a * 0 op b * 0; }
 
 zero(zeq, ==) zero(zne, !=) zero(zlt, <)
@@ -10,7 +18,7 @@ 
 zero(zgt, >)  zero(zge, >=) zero(zle, <=)
 
 #define unsign_pos(name, op) \
-int name (unsigned a, unsigned b) \
+int32_t name (uint32_t a, uint32_t b) \
 { return a * 4 op b * 4; }
 
 unsign_pos(upeq, ==) unsign_pos(upne, !=) unsign_pos(uplt, <)
@@ -17,7 +25,7 @@ 
 unsign_pos(upgt, >)  unsign_pos(upge, >=) unsign_pos(uple, <=)
 
 #define unsign_neg(name, op) \
-int name (unsigned a, unsigned b) \
+int32_t name (uint32_t a, uint32_t b) \
 { return a * -2 op b * -2; }
 
 unsign_neg(uneq, ==) unsign_neg(unne, !=) unsign_neg(unlt, <)
@@ -24,7 +32,7 @@ 
 unsign_neg(ungt, >)  unsign_neg(unge, >=) unsign_neg(unle, <=)
 
 #define float(name, op) \
-int name (float a, float b) \
+int32_t name (float a, float b) \
 { return a * 5 op b * 5; }
 
 float(feq, ==) float(fne, !=) float(flt, <)
@@ -31,7 +39,7 @@ 
 float(fgt, >)  float(fge, >=) float(fle, <=)
 
 #define float_val(name, op) \
-int name (int a, int b) \
+int32_t name (int32_t a, int32_t b) \
 { return a * 54.0 op b * 54.0; }
 
 float_val(fveq, ==) float_val(fvne, !=) float_val(fvlt, <)
@@ -38,8 +46,8 @@ 
 float_val(fvgt, >)  float_val(fvge, >=) float_val(fvle, <=)
 
 #define vec(name, op) \
-int name (int a, int b) \
-{ int c[10]; return a * c[1] op b * c[1]; }
+int32_t name (int32_t a, int32_t b) \
+{ int32_t c[10]; return a * c[1] op b * c[1]; }
 
 vec(veq, ==) vec(vne, !=) vec(vlt, <)
 vec(vgt, >)  vec(vge, >=) vec(vle, <=)