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]

Fix 19853



As discussed in the PR, the address of a variable that had been hiding inside a structure is not exposed early enough and then the optimizers fail to rename the variable.


This may only be the tip of the iceberg, though. We need to re-gimplify inside SRA and Ulrich has an Ada program that still fails because of all the symbols exposed in the gimplification. Ulrich, could you open a different PR for that Ada test case?

Bootstrapped and tested x86, x86-64, ppc and ia64.


Diego.
2005-02-14  Diego Novillo  <dnovillo@redhat.com>

	PR tree-optimization/19853
	* tree-dfa.c (add_referenced_var): Always examine DECL_INITIAL.


testsuite/ChangeLog

	PR tree-optimization/19853
	* gcc.c-torture/compile/pr19853.c: New test.

Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dfa.c,v
retrieving revision 2.44
diff -d -u -p -r2.44 tree-dfa.c
--- tree-dfa.c	10 Dec 2004 21:54:41 -0000	2.44
+++ tree-dfa.c	14 Feb 2005 19:39:53 -0000
@@ -901,8 +901,7 @@ add_referenced_var (tree var, struct wal
       /* Scan DECL_INITIAL for pointer variables as they may contain
 	 address arithmetic referencing the address of other
 	 variables.  */
-      if (DECL_INITIAL (var)
-	  && POINTER_TYPE_P (TREE_TYPE (var)))
+      if (DECL_INITIAL (var))
       	walk_tree (&DECL_INITIAL (var), find_vars_r, walk_state, 0);
     }
 }
Index: testsuite/gcc.c-torture/compile/pr19853.c
===================================================================
RCS file: testsuite/gcc.c-torture/compile/pr19853.c
diff -N testsuite/gcc.c-torture/compile/pr19853.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.c-torture/compile/pr19853.c	14 Feb 2005 19:40:04 -0000
@@ -0,0 +1,19 @@
+struct test { int *x; } global_test;
+int global_int;
+
+int flag;
+
+void test (char *dummy)
+{
+  static const struct test const_test = { &global_int };
+  struct test local_test;
+
+  int i;
+  for (i = 0; i < 1; i++)
+    *dummy = 0;
+  if (flag)
+    __builtin_memset (dummy, 0, 16);
+
+  local_test = const_test;
+  global_test = local_test;
+}

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