aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-12-16 00:08:47 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2007-12-16 00:08:47 +0100
commit9a60b229e8e64f37baf6ac78e0550291f542a9cc (patch)
tree504c98e8c6a5f6b4998669fdca1642b89bc80b93
parent249b9e5e0a8ebf5fcd02820b078ac81b30600f30 (diff)
downloadgcc-9a60b229e8e64f37baf6ac78e0550291f542a9cc.zip
gcc-9a60b229e8e64f37baf6ac78e0550291f542a9cc.tar.gz
gcc-9a60b229e8e64f37baf6ac78e0550291f542a9cc.tar.bz2
re PR bootstrap/34003 (gcc trunk unable to bootstrap itself; Unsatisfied symbols: ggc_free)
PR bootstrap/34003 * c-decl.c (merge_decls): Copy RTL from olddecl to newdecl. * config/pa/pa.c (pa_encode_section_info): If !first, preserve SYMBOL_FLAG_REFERENCED flag. * gcc.dg/pr34003-1.c: New test. * gcc.dg/pr34003-2.c: New. From-SVN: r130979
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-decl.c3
-rw-r--r--gcc/config/pa/pa.c8
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/pr34003-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr34003-2.c20
6 files changed, 52 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc72887..054ef8f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/34003
+ * c-decl.c (merge_decls): Copy RTL from olddecl to newdecl.
+ * config/pa/pa.c (pa_encode_section_info): If !first, preserve
+ SYMBOL_FLAG_REFERENCED flag.
+
2007-12-15 Alexandre Oliva <aoliva@redhat.com>
* tree.c (type_hash_add): Fix whitespace.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 1da57c2..033ff2e 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1670,6 +1670,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
}
}
+ /* Keep the old rtl since we can safely use it. */
+ if (HAS_RTL_P (olddecl))
+ COPY_DECL_RTL (olddecl, newdecl);
/* Merge the type qualifiers. */
if (TREE_READONLY (newdecl))
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index b1f3a00..b4d890c 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -7834,6 +7834,12 @@ hppa_encode_label (rtx sym)
static void
pa_encode_section_info (tree decl, rtx rtl, int first)
{
+ int old_referenced = 0;
+
+ if (!first && MEM_P (rtl) && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF)
+ old_referenced
+ = SYMBOL_REF_FLAGS (XEXP (rtl, 0)) & SYMBOL_FLAG_REFERENCED;
+
default_encode_section_info (decl, rtl, first);
if (first && TEXT_SPACE_P (decl))
@@ -7842,6 +7848,8 @@ pa_encode_section_info (tree decl, rtx rtl, int first)
if (TREE_CODE (decl) == FUNCTION_DECL)
hppa_encode_label (XEXP (rtl, 0));
}
+ else if (old_referenced)
+ SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= old_referenced;
}
/* This is sort of inverse to pa_encode_section_info. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3ceb531..b3dc9af 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/34003
+ * gcc.dg/pr34003-1.c: New test.
+ * gcc.dg/pr34003-2.c: New.
+
2007-12-15 Hans-Peter Nilsson <hp@axis.com>
* gcc.target/cris/peep2-xsrand.c, gcc.target/cris/asmreg-1.c,
diff --git a/gcc/testsuite/gcc.dg/pr34003-1.c b/gcc/testsuite/gcc.dg/pr34003-1.c
new file mode 100644
index 0000000..ff97fe6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr34003-1.c
@@ -0,0 +1,8 @@
+/* PR bootstrap/34003 */
+/* { dg-do link } */
+/* { dg-options "-O0" } */
+/* { dg-additional-sources "pr34003-2.c" } */
+
+extern void foo (void);
+int bar (void) { foo (); return 1; }
+extern void foo (void);
diff --git a/gcc/testsuite/gcc.dg/pr34003-2.c b/gcc/testsuite/gcc.dg/pr34003-2.c
new file mode 100644
index 0000000..a533056
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr34003-2.c
@@ -0,0 +1,20 @@
+/* PR bootstrap/34003 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+extern void abort (void);
+
+int seen = 0;
+
+void foo (void)
+{
+ ++seen;
+}
+
+int main (void)
+{
+ extern int bar (void);
+ if (bar () != 1 || seen != 1)
+ abort ();
+ return 0;
+}