[PATCH] More testcases for PR45967

Richard Guenther rguenther@suse.de
Mon Jan 17 12:26:00 GMT 2011


These show that also older releases had the underlying issue.

Committed.

Richard.

2011-01-17  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45967
	* gcc.dg/torture/pr45967-2.c: New testcase.
	* gcc.dg/torture/pr45967-3.c: Likewise.

Index: gcc/testsuite/gcc.dg/torture/pr45967-2.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr45967-2.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr45967-2.c	(revision 0)
***************
*** 0 ****
--- 1,24 ----
+ /* { dg-do run } */
+ 
+ extern void abort (void);
+ int b;
+ void
+ foo (void *p_, int *q)
+ {
+   int *p;
+   int i;
+   for (i = 0; i < sizeof(int *); ++i)
+     ((char *)&p)[i] = ((char *)p_)[i];
+   if (b)
+     p = q;
+   *p = 1;
+ }
+ int main()
+ {
+   int i = 0, j;
+   int *p = &i;
+   foo (&p, &j);
+   if (i != 1)
+     abort ();
+   return 0;
+ }
Index: gcc/testsuite/gcc.dg/torture/pr45967-3.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr45967-3.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr45967-3.c	(revision 0)
***************
*** 0 ****
--- 1,21 ----
+ /* { dg-do run } */
+ 
+ extern void abort (void);
+ void
+ foo (void *p_)
+ {
+   int *p;
+   int i;
+   for (i = 0; i < sizeof(int *); ++i)
+     ((char *)&p)[i] = ((char *)p_)[i];
+   *p = 1;
+ }
+ int main()
+ {
+   int i = 0;
+   int *p = &i;
+   foo (&p);
+   if (i != 1)
+     abort ();
+   return 0;
+ }



More information about the Gcc-patches mailing list