This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] remove spurious assignment to avoid ICE (PR 92493)


I checked in the attached change in r278423 to avoid the ICE
reported in the PR and introduced in a recent commit of mine.
The change was bootstrapped and regtested on x86_64-linux.

Martin

PR middle-end/92493 - ICE in get_origin_and_offset at gimple-ssa-sprintf.c

gcc/ChangeLog:

	PR tree-optimization/92493
	* gimple-ssa-sprintf.c (get_origin_and_offset): Remove spurious
	assignment.

gcc/testsuite/ChangeLog:

	PR tree-optimization/92493
	* gcc.dg/pr92493.c: New test.

Index: gcc/gimple-ssa-sprintf.c
===================================================================
--- gcc/gimple-ssa-sprintf.c	(revision 278418)
+++ gcc/gimple-ssa-sprintf.c	(working copy)
@@ -2346,7 +2346,6 @@ get_origin_and_offset (tree x, HOST_WIDE_INT *fldo
 	    {
 	      *fldoff += index;
 	      *off -= index;
-	      fldoff = NULL;
 	    }
 	}
 
Index: gcc/testsuite/gcc.dg/pr92493.c
===================================================================
--- gcc/testsuite/gcc.dg/pr92493.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr92493.c	(working copy)
@@ -0,0 +1,29 @@
+/* PR middle-end/92493 - ICE in get_origin_and_offset at gimple-ssa-sprintf.c
+   { dg-do compile }
+   { dg-options "-O3 -Wall" } */
+
+struct A
+{
+  int i;
+  char a[2];
+} *p;
+
+struct B
+{
+  short j;
+  struct A a;
+} b;
+
+void warn (int j)
+{
+  struct A *q = &b.a;
+  p = q + j;
+  __builtin_snprintf (p->a, 8, "%s", p->a);   // { dg-warning "\\\[-Wrestrict" }
+}
+
+void nowarn (char *d, int j)
+{
+  struct A *q = &b.a;
+  p = q + j;
+  __builtin_snprintf (d, 8, "%s", p->a);
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]