diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-11-19 10:26:33 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-11-19 10:26:33 +0100 |
commit | cf651ca2e559c5f56f23764f1c90108c52015ea0 (patch) | |
tree | 03ad52bf6cb39e5e03380e6202c1d82ec366d4bb /gcc/fortran/trans-decl.c | |
parent | ea5cbe6161d115541b7b1dee24d6f07b269cb1bb (diff) | |
download | gcc-cf651ca2e559c5f56f23764f1c90108c52015ea0.zip gcc-cf651ca2e559c5f56f23764f1c90108c52015ea0.tar.gz gcc-cf651ca2e559c5f56f23764f1c90108c52015ea0.tar.bz2 |
re PR fortran/51207 ([OOP] Mark __def_init_... as FL_PARAMETER)
2011-11-19 Tobias Burnus <burnus@net-b.de>
PR fortran/51207
* class.c (gfc_find_derived_vtab): Mark __def_init as PARAMETER
and hence as TREE_READONLY; add subroutine attribute to
__copy_ procedure.
PR fortran/50640
* trans.h (GFC_DECL_PUSH_TOPLEVEL): New DECL_LANG_FLAG_7.
* trans-decl.c (gfc_get_symbol_decl): Mark __def_init and vtab
as GFC_DECL_PUSH_TOPLEVEL.
(gfc_generate_function_code): If GFC_DECL_PUSH_TOPLEVEL, push it there.
(build_function_decl): Push __copy_ procedure to the toplevel.
From-SVN: r181505
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 02c0ed7..fc8a9ed 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1471,6 +1471,10 @@ gfc_get_symbol_decl (gfc_symbol * sym) && !sym->attr.proc_pointer) DECL_BY_REFERENCE (decl) = 1; + if (sym->attr.vtab + || (sym->name[0] == '_' && strncmp ("__def_init", sym->name, 10) == 0)) + GFC_DECL_PUSH_TOPLEVEL (decl) = 1; + return decl; } @@ -1891,7 +1895,8 @@ build_function_decl (gfc_symbol * sym, bool global) /* Layout the function declaration and put it in the binding level of the current function. */ - if (global) + if (global + || (sym->name[0] == '_' && strncmp ("__copy", sym->name, 6) == 0)) pushdecl_top_level (fndecl); else pushdecl (fndecl); @@ -5316,7 +5321,10 @@ gfc_generate_function_code (gfc_namespace * ns) next = DECL_CHAIN (decl); DECL_CHAIN (decl) = NULL_TREE; - pushdecl (decl); + if (GFC_DECL_PUSH_TOPLEVEL (decl)) + pushdecl_top_level (decl); + else + pushdecl (decl); decl = next; } saved_function_decls = NULL_TREE; |