Consider static const double foo_local = 1.0; #pragma weak foo = foo_local with unit-at-a-time we get rid of the foo_local variable (because it is unused apart form the weak decl). This is a regression from 4.0 where we correctly mark foo_local as referenced. This breaks building Xorg. rth fixed it for 4.0, somehow the bug came back.
Confirmed, be failing since at least 20050827.
See PR19031 where this problem was fixed for 4.0.0.
Failing started before 20050801.
And has been failing since 20050701. Maybe we need a machine which just builds a distro over and over. I know Apple has a such a beast for Mac OS X.
Happens in 20050601 also.
Happens also in 20050501.
Fails with 20050401 also.
Works in 20050320.
CCing Honza since the tree profiling branch merge happened during that time.
Works with 20050321.
Works on 20050325.
(In reply to comment #11) > Works on 20050325. The top of the changelog at this time is: 2005-03-24 Kazu Hirata <kazu@cs.umass.edu> * emit-rtl.c (reverse_comparison): Remove. * rtl.h: Remove the corresponding prototype.
Works with 20050328.
(In reply to comment #13) > Works with 20050328. Note the top of the changelog is: 2005-03-27 Steven Bosscher <stevenb@suse.de> * vax-protos.h (vax_output_int_move, vax_output_int_add, vax_output_conditional_branch): New prototypes. I don't think this was caused by the merge of the tree-profiling after all.
I am starting to think the following patch caused it: -2005-03-29 Jakub Jelinek <jakub@redhat.com> - - PR middle-end/20622 - * cgraph.h (struct cgraph_varpool_node): Add alias field. - * cgraph.c (cgraph_varpool_assemble_pending_decls): Don't call - assemble_variable on aliases. - * varasm.c (assemble_alias): Set node->alias. - * toplev.c (wrapup_global_declarations): Don't call - rest_of_decl_compilation on aliases again.
A regression hunt identified this patch from hubicka on 2005-03-30: http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01487.html
We want to cgraph_varpool_mark_needed_node the rhs of the #pragma weak, but by the time we get to maybe_apply_pending_pragma_weaks, we only have the identifier, and AFAICT no way to find the appropriate symbol that we want to mark as needed. Here, I've just made the pragma handler force the rhs of the #pragma weak into the assembler file. Without force_output, the "unreferenced" rhs will still be dropped from the cgraph by cgraph_varpool_remove_unreferenced_decls, and there is no way to tell from there that this variable is needed, other than forcing it to be written out. This is a hack, but the way we find out about necessary nodes is so complicated that I don't fully understand how this is supposed to be fixed. I think fixing this completely requires that we keep a list of DECLs instead of IDENTIFIER_NODEs for the pending #pragma weak list, so that we can mark the DECL of pending pragmas from maybe_apply_pragma_weak. Or maybe there is another way to get the DECL for alias_id there? Index: c-pragma.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/c-pragma.c,v retrieving revision 1.91 diff -u -3 -p -r1.91 c-pragma.c --- c-pragma.c 19 Jul 2005 20:19:12 -0000 1.91 +++ c-pragma.c 18 Oct 2005 22:23:57 -0000 @@ -36,6 +36,7 @@ Software Foundation, 51 Franklin Street, #include "tm_p.h" #include "vec.h" #include "target.h" +#include "cgraph.h" #define GCC_BAD(gmsgid) \ do { warning (OPT_Wpragmas, gmsgid); return; } while (0) @@ -310,7 +311,7 @@ maybe_apply_pending_pragma_weaks (void) alias_id = TREE_PURPOSE (t); id = TREE_VALUE (t); - if (TREE_VALUE (t) == NULL) + if (id == NULL) continue; decl = build_decl (FUNCTION_DECL, alias_id, default_function_type); @@ -330,6 +331,7 @@ handle_pragma_weak (cpp_reader * ARG_UNU { tree name, value, x, decl; enum cpp_ttype t; + struct cgraph_varpool_node *node; value = 0; @@ -354,6 +356,15 @@ handle_pragma_weak (cpp_reader * ARG_UNU } else pending_weaks = tree_cons (name, value, pending_weaks); + + decl = identifier_global_value (value); + if (decl && DECL_P (decl)) + { + /* Force DECL into the assembler output no matter what. */ + node = cgraph_varpool_node (decl); + cgraph_varpool_mark_needed_node (node); + node->force_output = true; + } } #else void
+ decl = identifier_global_value (value); Make that + decl = decl ? identifier_global_value (value) : NULL_TREE; and it even survives bootstrap.
err, s/decl/value/ of course.
Subject: Bug 24295 CVSROOT: /cvs/gcc Module name: gcc Changes by: aoliva@gcc.gnu.org 2005-10-20 19:30:23 Modified files: gcc/testsuite : ChangeLog gcc : ChangeLog cgraphunit.c varasm.c gcc/testsuite/g++.old-deja/g++.abi: vtable2.C Added files: gcc/testsuite/gcc.dg: attr-alias-3.c gcc/testsuite/gcc.dg/weak: weak-14.c Log message: gcc/ChangeLog: PR middle-end/24295 * cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Mark alias targets. * varasm.c (find_decl_and_mark_needed): After cgraph global info is ready, stop marking functions, but still mark variables. gcc/testsuite/ChangeLog: PR middle-end/24295 * g++.old-deja/g++.abi/vtable2.C: Do not introduce external declarations with the same names as thunks' alias targets, use aliases instead. * gcc.dg/attr-alias-3.c: New test. * gcc.dg/weak/weak-14.c, gcc.dg/weak/weak-14a.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6219&r2=1.6220 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10193&r2=2.10194 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cgraphunit.c.diff?cvsroot=gcc&r1=1.129&r2=1.130 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&r1=1.533&r2=1.534 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C.diff?cvsroot=gcc&r1=1.7&r2=1.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/attr-alias-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/weak/weak-14.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.
Subject: Bug 24295 CVSROOT: /cvs/gcc Module name: gcc Changes by: aoliva@gcc.gnu.org 2005-10-25 18:59:21 Modified files: gcc/testsuite : ChangeLog gcc/testsuite/g++.old-deja/g++.abi: vtable2.C Log message: PR middle-end/24295, PR testsuite/24477 * g++.old-deja/g++.abi/vtable2.C: Require alias for now. Will be removed when weakref hits the tree. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6252&r2=1.6253 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C.diff?cvsroot=gcc&r1=1.8&r2=1.9