From: Senthil Kumar Selvaraj Date: Tue, 29 Nov 2016 11:21:46 +0000 (+0000) Subject: Fix bogus pr31096-1.c failure for avr X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11edabc2dfb9274445d697eff2bafde3abdefa1f;p=gcc.git Fix bogus pr31096-1.c failure for avr 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 * testsuite/gcc.dg/pr31096-1.c: Use __{U,}INT32_TYPE__ for targets with sizeof(int) < 4. From-SVN: r242954 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d209fcbbce8..101a6e0689a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-29 Senthil Kumar Selvaraj + + * testsuite/gcc.dg/pr31096-1.c: Use __{U,}INT32_TYPE__ for + targets with sizeof(int) < 4. + 2016-11-29 Richard Biener PR middle-end/78546 diff --git a/gcc/testsuite/gcc.dg/pr31096-1.c b/gcc/testsuite/gcc.dg/pr31096-1.c index e681f0fcee6..3866c7578b7 100644 --- a/gcc/testsuite/gcc.dg/pr31096-1.c +++ b/gcc/testsuite/gcc.dg/pr31096-1.c @@ -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, <=)