[testsuite] Fix bogus pr64427.c failure for avr

Submitted by Senthil Kumar Selvaraj on Nov. 25, 2016, 8:22 a.m.

Details

Message ID 87d1hkc6jr.fsf@atmel.com
State New
Headers show

Commit Message

Senthil Kumar Selvaraj Nov. 25, 2016, 8:22 a.m.
The smaller int size for the avr target breaks the test's
  expectation on the number of iterations. The failure goes
  away if 32 bit ints are used in place of a plain int.

  Fix by conditionally typedef int32_t to __INT32_TYPE__ for targets
  with int size < 4,  and then use int32_t everywhere.

Regards
Senthil

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

	* gcc.dg/pr64277.c: Use 32 bit int for targets
	with sizeof(int) < 4.

Patch hide | download patch | download mbox

Index: gcc/testsuite/gcc.dg/pr64277.c
===================================================================
--- gcc/testsuite/gcc.dg/pr64277.c	(revision 242857)
+++ gcc/testsuite/gcc.dg/pr64277.c	(working copy)
@@ -4,10 +4,16 @@ 
 /* { dg-final { scan-tree-dump "loop with 5 iterations completely unrolled" "cunroll" } } */
 /* { dg-final { scan-tree-dump "loop with 6 iterations completely unrolled" "cunroll" } } */
 
-int f1[10];
+#if __SIZEOF_INT__ < 4
+  __extension__ typedef __INT32_TYPE__ int32_t;
+#else
+  typedef int int32_t;
+#endif
+
+int32_t f1[10];
 void test1 (short a[], short m, unsigned short l)
 {
-  int i = l;
+  int32_t i = l;
   for (i = i + 5; i < m; i++)
     f1[i] = a[i]++;
 }
@@ -14,7 +20,7 @@ 
 
 void test2 (short a[], short m, short l)
 {
-  int i;
+  int32_t i;
   if (m > 5)
     m = 5;
   for (i = m; i > l; i--)