Patchwork [PR45098] Disallow NULL pointer in pointer arithmetic

login
register
mail settings
Submitter Tom de Vries
Date June 16, 2011, 6:42 a.m.
Message ID <4DF9A5E9.8080703@codesourcery.com>
Download mbox | patch
Permalink /patch/100597/
State New
Headers show

Comments

Tom de Vries - June 16, 2011, 6:42 a.m.
On 06/16/2011 08:39 AM, Tom de Vries wrote:
> I will sent the adapted test cases in a separate email.

Update 2 test cases to be more strict, and more like the original example.

Thanks,
- Tom

2011-06-15  Tom de Vries  <tom@codesourcery.com>

	PR target/45098
	* gcc.target/arm/ivopts-3.c: Update test.
	* gcc.target/arm/ivopts-5.c: Same.

Patch

diff -u gcc/testsuite/gcc.target/arm/ivopts-3.c (revision 0) gcc/testsuite/gcc.target/arm/ivopts-3.c (revision 0)
--- gcc/testsuite/gcc.target/arm/ivopts-3.c (revision 0)
+++ gcc/testsuite/gcc.target/arm/ivopts-3.c (revision 0)
@@ -8,14 +8,8 @@ 
 {
   int sum = 0;
   unsigned int x;
-  x = 0;
-  while (1)
-    {
-      sum += foo2 (&array[x]);
-      if (!(x < n))
-        break;
-      x++;
-    }
+  for (x = 0; x < n; ++x)
+    sum += foo2 (&array[x]);
   return sum;
 }
 
diff -u gcc/testsuite/gcc.target/arm/ivopts-5.c (revision 0) gcc/testsuite/gcc.target/arm/ivopts-5.c (revision 0)
--- gcc/testsuite/gcc.target/arm/ivopts-5.c (revision 0)
+++ gcc/testsuite/gcc.target/arm/ivopts-5.c (revision 0)
@@ -8,14 +8,8 @@ 
 {
   int sum = 0;
   unsigned int x;
-  x = 0;
-  while (1)
-    {
-      sum += foo (&array[x]);
-      if (!(x < n))
-        break;
-      x++;
-    }
+  for (x = 0; x < n; ++x)
+    sum += foo (&array[x]);
   return sum;
 }