summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-26 11:16:31 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-26 11:16:31 +0000
commit9e45357a9a3fac1b1d2e7fed97e694f0018f9ca5 (patch)
tree9eb2f79f7f351d91466677ca64aaf9814e387c4d /gcc/fortran/trans-decl.c
parent07c5a4621f5d3fefd273a03b35b94b53290815ff (diff)
downloadgcc-9e45357a9a3fac1b1d2e7fed97e694f0018f9ca5.tar.gz
2012-11-26 Janus Weil <janus@gcc.gnu.org>
PR fortran/54997 * decl.c (match_procedure_decl): Don't set 'referenced' attribute for PROCEDURE declarations. * parse.c (gfc_fixup_sibling_symbols,parse_contained): Don't set 'referenced' attribute for all contained procedures. * trans-decl.c (gfc_get_symbol_decl): Allow for unreferenced procedures. (build_function_decl): Set TREE_USED for referenced procedures. 2012-11-26 Janus Weil <janus@gcc.gnu.org> PR fortran/54997 * gfortran.dg/warn_unused_function_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193811 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 6827298b86e..9adcb8bddb2 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1195,10 +1195,11 @@ gfc_get_symbol_decl (gfc_symbol * sym)
bool intrinsic_array_parameter = false;
gcc_assert (sym->attr.referenced
- || sym->attr.use_assoc
- || sym->ns->proc_name->attr.if_source == IFSRC_IFBODY
- || (sym->module && sym->attr.if_source != IFSRC_DECL
- && sym->backend_decl));
+ || sym->attr.flavor == FL_PROCEDURE
+ || sym->attr.use_assoc
+ || sym->ns->proc_name->attr.if_source == IFSRC_IFBODY
+ || (sym->module && sym->attr.if_source != IFSRC_DECL
+ && sym->backend_decl));
if (sym->ns && sym->ns->proc_name && sym->ns->proc_name->attr.function)
byref = gfc_return_by_reference (sym->ns->proc_name);
@@ -1851,6 +1852,9 @@ build_function_decl (gfc_symbol * sym, bool global)
|| sym->attr.public_used))
TREE_PUBLIC (fndecl) = 1;
+ if (sym->attr.referenced || sym->attr.entry_master)
+ TREE_USED (fndecl) = 1;
+
attributes = add_attributes_to_decl (attr, NULL_TREE);
decl_attributes (&fndecl, attributes, 0);