diff options
author | Martin Jambor <mjambor@suse.cz> | 2013-08-06 14:48:53 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2013-08-06 14:48:53 +0200 |
commit | 15682f2418221ee45ebf9fd2c4803fb179060c42 (patch) | |
tree | 54d423cab2471b50ef6202932602d8e48f3f22b2 /gcc/cgraphunit.c | |
parent | 6ffd1096cf7620eea04f99693c32601e9312cd8c (diff) | |
download | gcc-15682f2418221ee45ebf9fd2c4803fb179060c42.zip gcc-15682f2418221ee45ebf9fd2c4803fb179060c42.tar.gz gcc-15682f2418221ee45ebf9fd2c4803fb179060c42.tar.bz2 |
re PR fortran/57987 (Fortran finalizers considered extern-inline by middle-end)
2013-08-06 Martin Jambor <mjambor@suse.cz>
PR fortran/57987
* cgraphunit.c (cgraph_finalize_function): Assert that nested function
is not re-finalized. Rename second parameter to no_collect.
fortran/
* trans-decl.c (gfc_generate_function_code): Never call
cgraph_finalize_function on nested functions.
testsuite/
* gfortran.dg/pr57987.f90: New test.
From-SVN: r201526
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index ad91117..cf92b1d 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -404,17 +404,20 @@ referred_to_p (symtab_node node) } /* 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 + logic in effect. If NO_COLLECT is true, then our caller cannot stand to have the garbage collector run at the moment. We would need to either create a new GC context, or just not compile right now. */ void -cgraph_finalize_function (tree decl, bool nested) +cgraph_finalize_function (tree decl, bool no_collect) { struct cgraph_node *node = cgraph_get_create_node (decl); if (node->symbol.definition) { + /* Nested functions should only be defined once. */ + gcc_assert (!DECL_CONTEXT (decl) + || TREE_CODE (DECL_CONTEXT (decl)) != FUNCTION_DECL); cgraph_reset_node (node); node->local.redefined_extern_inline = true; } @@ -453,7 +456,7 @@ cgraph_finalize_function (tree decl, bool nested) if (warn_unused_parameter) do_warn_unused_parameter (decl); - if (!nested) + if (!no_collect) ggc_collect (); if (cgraph_state == CGRAPH_STATE_CONSTRUCTION |