diff options
author | Jan Hubicka <jh@suse.cz> | 2012-04-25 16:54:21 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-04-25 14:54:21 +0000 |
commit | 838ff415aed1282e62247bac07e80955d8c85aeb (patch) | |
tree | 9d3f2a88445e1af7a691390a56d3f28b6e0b952e | |
parent | f1cc958978c4b3a76ccf96571972f95963c9f0ea (diff) | |
download | gcc-838ff415aed1282e62247bac07e80955d8c85aeb.tar.gz |
re PR middle-end/53089 (gfortran.dg/coarray/atomic_1.f90 and gfortran.dg/coarray/registering_1.f90)
PR middle-end/53089
* cgraphunit.c (referred_to_p): Move ahead in file to avoid forward declaration.
(cgraph_finalize_function): Finalize them here.
* symtab.c (dump_symtab): Dump ctors and dtors.
From-SVN: r186820
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 37 | ||||
-rw-r--r-- | gcc/symtab.c | 7 |
3 files changed, 35 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5154ec73c4..99203ffb398 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-04-25 Jan Hubicka <jh@suse.cz> + + PR middle-end/53089 + * cgraphunit.c (referred_to_p): Move ahead in file to avoid forward declaration. + (cgraph_finalize_function): Finalize them here. + * symtab.c (dump_symtab): Dump ctors and dtors. + 2012-04-25 Jakub Jelinek <jakub@redhat.com> PR middle-end/52979 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index f896d1e908d..a58cd08c0d9 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -320,6 +320,22 @@ cgraph_reset_node (struct cgraph_node *node) cgraph_node_remove_callees (node); } +/* Return true when there are references to NODE. */ + +static bool +referred_to_p (symtab_node node) +{ + int i; + struct ipa_ref *ref; + + for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); + i++) + return true; + if (symtab_function_p (node) && cgraph (node)->callers) + return true; + return false; +} + /* DECL has been parsed. Take it, queue it, compile it at the whim of the logic in effect. If NESTED is true, then our caller cannot stand to have the garbage collector run at the moment. We would need to either create @@ -372,6 +388,11 @@ cgraph_finalize_function (tree decl, bool nested) if (!nested) ggc_collect (); + + if (cgraph_state == CGRAPH_STATE_CONSTRUCTION + && (cgraph_decide_is_function_needed (node, decl) + || referred_to_p ((symtab_node)node))) + enqueue_node ((symtab_node)node); } /* Add the function FNDECL to the call graph. @@ -1114,22 +1135,6 @@ process_function_and_variable_attributes (struct cgraph_node *first, } } -/* Return true when there are references to NODE. */ - -static bool -referred_to_p (symtab_node node) -{ - int i; - struct ipa_ref *ref; - - for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); - i++) - return true; - if (symtab_function_p (node) && cgraph (node)->callers) - return true; - return false; -} - /* Mark DECL as finalized. By finalizing the declaration, frontend instruct the middle end to output the variable to asm file, if needed or externally visible. */ diff --git a/gcc/symtab.c b/gcc/symtab.c index 975fdef89b1..f39376303ec 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -414,6 +414,13 @@ dump_symtab_base (FILE *f, symtab_node node) fprintf (f, " virtual"); if (DECL_ARTIFICIAL (node->symbol.decl)) fprintf (f, " artificial"); + if (TREE_CODE (node->symbol.decl) == FUNCTION_DECL) + { + if (DECL_STATIC_CONSTRUCTOR (node->symbol.decl)) + fprintf (f, " constructor"); + if (DECL_STATIC_DESTRUCTOR (node->symbol.decl)) + fprintf (f, " destructor"); + } fprintf (f, "\n"); if (node->symbol.same_comdat_group) |