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

login
register
mail settings
Submitter Georg-Johann Lay
Date Sept. 7, 2011, 4:42 p.m.
Message ID <4E679EF9.8000701@gjlay.de>
Download mbox | patch
Permalink /patch/113795/
State New
Headers show

Comments

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

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