aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>2017-03-21 12:05:09 +0000
committerSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>2017-03-21 12:05:09 +0000
commitd8e0abb8771822eee695841b69a13747d9806f7e (patch)
tree51d385e2eca02bf4cb4968c332403afb0dc2be40
parentace9f0de45ca8dc0ee7ccf0e6ec1bd9251e49d5c (diff)
Fix failing overflow-1.c for avr
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@246318 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c18
2 files changed, 17 insertions, 6 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 616eb0bdb43..086c6d34d65 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c b/gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
index e126609c53d..b664d0f120a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/overflow-1.c
@@ -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;
}