summaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-18 12:38:02 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-18 12:38:02 +0000
commit18d2fbb474371f8ed38d7023e106620e12505ab4 (patch)
tree03b723c0931642c3551a0ea6b0b5a91a10b888cc /gcc/fortran/module.c
parenteb1d84c09e14dfb474e06ba5fcbc8b173689e456 (diff)
2017-03-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/79676 * module.c (mio_symbol_attribute): Remove reset of the flag 'no_module_procedures'. (check_for_module_procedures): New function. Move declaration of 'no_module_procedures' to above it. (gfc_dump_module): Traverse namespace calling new function. 2017-03-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/79676 * gfortran.dg/submodule_28.f08 : New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246256 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 5515fed4ab4e..80a65244600a 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -193,10 +193,6 @@ static const char *module_name;
/* The name of the .smod file that the submodule will write to. */
static const char *submodule_name;
-/* Suppress the output of a .smod file by module, if no module
- procedures have been seen. */
-static bool no_module_procedures;
-
static gfc_use_list *module_list;
/* If we're reading an intrinsic module, this is its ID. */
@@ -2243,10 +2239,7 @@ mio_symbol_attribute (symbol_attribute *attr)
if (attr->array_outer_dependency)
MIO_NAME (ab_attribute) (AB_ARRAY_OUTER_DEPENDENCY, attr_bits);
if (attr->module_procedure)
- {
MIO_NAME (ab_attribute) (AB_MODULE_PROCEDURE, attr_bits);
- no_module_procedures = false;
- }
if (attr->oacc_declare_create)
MIO_NAME (ab_attribute) (AB_OACC_DECLARE_CREATE, attr_bits);
if (attr->oacc_declare_copyin)
@@ -6139,6 +6132,18 @@ dump_module (const char *name, int dump_flag)
}
+/* Suppress the output of a .smod file by module, if no module
+ procedures have been seen. */
+static bool no_module_procedures;
+
+static void
+check_for_module_procedures (gfc_symbol *sym)
+{
+ if (sym && sym->attr.module_procedure)
+ no_module_procedures = false;
+}
+
+
void
gfc_dump_module (const char *name, int dump_flag)
{
@@ -6148,6 +6153,8 @@ gfc_dump_module (const char *name, int dump_flag)
dump_smod =false;
no_module_procedures = true;
+ gfc_traverse_ns (gfc_current_ns, check_for_module_procedures);
+
dump_module (name, dump_flag);
if (no_module_procedures || dump_smod)