This is the mail archive of the 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]

[PATCH, PR 61090] Pass gsi to build_ref_for_model in sra_modify_expr


my patch switching to more correct alias introduced an error into the
call of build_ref_for_model also in sra_modify_expr (when avoiding
VIEW_CONVERT_EXPR).  We are no longer using access->base as the base
for the memory expression being built, but rather the original
expression from the source.  This means we may encounter an ARRAY_REF
and need an iterator for producing potential extra statements.

Fixed simply by the following patch which provides the iterator we
have at hand.  Bootstrapped and tested on x86_64-linux.  OK for trunk?



2014-05-14  Martin Jambor  <>

	PR tree-optimization/61090
	* tree-sra.c (sra_modify_expr): Pass the current gsi to

	* gcc.dg/tree-ssa/pr61090.c: New test.

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61090.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61090.c
new file mode 100644
index 0000000..fff2895
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr61090.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+struct i {
+   int c;
+static int
+p(struct i a)
+  return 0;
+  struct i z[] = {{ 0 }};
+  int e[] = {};
+  int x;
+  e[0] = p(z[x]) + z[x].c;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 72c485b..ef6c966 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2812,7 +2812,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
 	  tree ref;
-	  ref = build_ref_for_model (loc, orig_expr, 0, access, NULL, false);
+	  ref = build_ref_for_model (loc, orig_expr, 0, access, gsi, false);
 	  if (write)

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