This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Fix PR 14694
- From: Diego Novillo <dnovillo at redhat dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Tue, 23 Mar 2004 16:30:06 -0500
- Subject: [tree-ssa] Fix PR 14694
- Organization: Red Hat Canada
Details about the failure and the fix at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14694.
Richard, could you check it out? It's in the function unnesting pass
and I want to make sure I'm not papering over the problem.
Bootstrapped and tested x86 and x86-64.
Thanks. Diego.
* tree-nested.c (convert_nonlocal_reference): Don't process
global variables.
(convert_local_reference): Likewise.
testsuite/ChangeLog.tree-ssa
* gcc.c-torture/compile/20040323-1.c: New test.
Index: tree-nested.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-nested.c,v
retrieving revision 1.1.2.4
diff -d -c -p -d -u -p -r1.1.2.4 tree-nested.c
--- tree-nested.c 18 Mar 2004 22:43:56 -0000 1.1.2.4
+++ tree-nested.c 23 Mar 2004 21:15:58 -0000
@@ -55,7 +55,7 @@
The implementation here is much more direct. Everything that can be
referenced by an inner function is a member of an explicitly created
- structure herein called the "nonlocal frame struct". The incomming
+ structure herein called the "nonlocal frame struct". The incoming
static chain for a nested function is a pointer to this struct in
the parent. In this way, we settle on known offsets from a known
base, and so are decoupled from the logic that places objects in the
@@ -717,7 +717,9 @@ convert_nonlocal_reference (tree *tp, in
{
case VAR_DECL:
/* Non-automatic variables are never processed. */
- if (TREE_STATIC (t) || DECL_EXTERNAL (t))
+ if (TREE_STATIC (t)
+ || DECL_EXTERNAL (t)
+ || decl_function_context (t) == NULL_TREE)
break;
/* FALLTHRU */
@@ -807,7 +809,9 @@ convert_local_reference (tree *tp, int *
{
case VAR_DECL:
/* Non-automatic variables are never processed. */
- if (TREE_STATIC (t) || DECL_EXTERNAL (t))
+ if (TREE_STATIC (t)
+ || DECL_EXTERNAL (t)
+ || decl_function_context (t) == NULL_TREE)
break;
/* FALLTHRU */
Index: testsuite/gcc.c-torture/compile/20040323-1.c
===================================================================
RCS file: testsuite/gcc.c-torture/compile/20040323-1.c
diff -N testsuite/gcc.c-torture/compile/20040323-1.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.c-torture/compile/20040323-1.c 23 Mar 2004 21:16:22 -0000
@@ -0,0 +1,15 @@
+/* Extracted from PR 14694 by Andrew Pinski. */
+
+extern unsigned int _rtld_local __attribute__ ((visibility ("hidden")));
+
+extern unsigned int _rtld_local
+ __attribute__ ((alias ("_rtld_global"), visibility ("hidden")));
+
+unsigned int
+_dl_start (void *arg)
+{
+ void elf_machine_rel ()
+ {
+ unsigned int value = (_rtld_local);
+ }
+}