diff mbox

[testsuite] : Fix gcc.c-torture/execute/pr48571-1.c (4 -> sizeof(int))

Message ID 4E679EF9.8000701@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay Sept. 7, 2011, 4:42 p.m. UTC
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.

Comments

Georg-Johann Lay Sept. 7, 2011, 4:57 p.m. UTC | #1
Georg-Johann Lay schrieb:
> 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.

Ok to commit?

> 
> 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
>
Mike Stump Sept. 7, 2011, 5:12 p.m. UTC | #2
On Sep 7, 2011, at 9:57 AM, Georg-Johann Lay wrote:
> Georg-Johann Lay schrieb:
>> 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.
> 
> Ok to commit?

Ok.
diff mbox

Patch

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