Fix bogus pr31096-1.c failure for avr
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Tue, 29 Nov 2016 11:21:46 +0000 (11:21 +0000)
committerSenthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
Tue, 29 Nov 2016 11:21:46 +0000 (11:21 +0000)
The dump expects literals which would only be present if the target's
int size is 32 bits.

Fix by explicitly using 32 bit ints for targets with __SIZEOF_INT__ < 4.

gcc/testsuite/
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.

From-SVN: r242954

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr31096-1.c

index d209fcb..101a6e0 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2016-11-29  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/78546
index e681f0f..3866c75 100644 (file)
@@ -2,44 +2,52 @@
 /* { 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, <)
 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, <)
 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, <)
 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, <)
 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, <)
 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, <=)