This patch fixes magic number 4 and uses sizeof(int) instead so that the test
no more fails on int=16 platforms. Successfully tested on AVR.
Johann
* gcc.c-torture/execute/pr48571-1.c (bar): Use offsets sizeof(int)
instead of 4.
Index: gcc.c-torture/execute/pr48571-1.c
===================================================================
--- gcc.c-torture/execute/pr48571-1.c (revision 178527)
+++ gcc.c-torture/execute/pr48571-1.c (working copy)
@@ -1,3 +1,5 @@
+#define S (sizeof (int))
+
unsigned int c[624];
void __attribute__((noinline))
bar (void)
@@ -5,9 +7,9 @@ bar (void)
unsigned int i;
/* Obfuscated c[i] = c[i-1] * 2. */
for (i = 1; i < 624; ++i)
- *(unsigned int *)((void *)c + (__SIZE_TYPE__)i * 4)
+ *(unsigned int *)((void *)c + (__SIZE_TYPE__)i * S)
= 2 * *(unsigned int *)((void *)c + ((__SIZE_TYPE__)i +
- ((__SIZE_TYPE__)-4)/4) * 4);
+ ((__SIZE_TYPE__)-S)/S) * S);
}
extern void abort (void);
int