Fix failing overflow-1.c for avr
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Tue, 21 Mar 2017 12:05:09 +0000 (12:05 +0000)
committerSenthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
Tue, 21 Mar 2017 12:05:09 +0000 (12:05 +0000)
The test assumes 32 bit ints, and expects a constant in the
dump that is only valid for 32 bit ints. Fix by explicitly
specifying __UINT32_TYPE__.

gcc/testsuite/

2017-03-21  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

* gcc.dg/tree-ssa/overflow-1.c: Use __UINT32_TYPE__ for targets
with sizeof(int) < 4.

From-SVN: r246318

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c

index 616eb0bdb438ee4e92dc484094c9062897fa1b7f..086c6d34d652d33384d505d32a12410ca053a377 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-21  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+       * gcc.dg/tree-ssa/overflow-1.c: Use __UINT32_TYPE__ for targets
+       with sizeof(int) < 4.
+
 2017-03-21  Martin Liska  <mliska@suse.cz>
 
        * gcc.target/i386/pr65044.c: Add '.' in order to catch
index e126609c53d9490ab65b5e641821b39e07891671..b664d0f120aa565700ef598811251f88c4d742b6 100644 (file)
@@ -1,14 +1,20 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fdump-tree-optimized" } */
 
-int f(unsigned a){
-    unsigned b=5;
-    unsigned c=a-b;
+#if __SIZEOF_INT__ < 4
+  __extension__ typedef __UINT32_TYPE__ uint32_t;
+#else
+  typedef unsigned uint32_t;
+#endif
+
+int f(uint32_t a){
+    uint32_t b=5;
+    uint32_t c=a-b;
     return c>a;
 }
-int g(unsigned a){
-    unsigned b=32;
-    unsigned c=a+b;
+int g(uint32_t a){
+    uint32_t b=32;
+    uint32_t c=a+b;
     return c<a;
 }