diff options
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 4116db8..e727ade 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -740,6 +740,7 @@ gfc_match_submodule (void) match m; char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_use_list *use_list; + bool seen_colon = false; if (!gfc_notify_std (GFC_STD_F2008, "SUBMODULE declaration at %C")) return MATCH_ERROR; @@ -772,7 +773,7 @@ gfc_match_submodule (void) } else { - module_list = use_list; + module_list = use_list; use_list->module_name = gfc_get_string (name); use_list->submodule_name = use_list->module_name; } @@ -780,8 +781,11 @@ gfc_match_submodule (void) if (gfc_match_char (')') == MATCH_YES) break; - if (gfc_match_char (':') != MATCH_YES) + if (gfc_match_char (':') != MATCH_YES + || seen_colon) goto syntax; + + seen_colon = true; } m = gfc_match (" %s%t", &gfc_new_block); @@ -6926,8 +6930,17 @@ gfc_use_module (gfc_use_list *module) } if (module_fp == NULL) - gfc_fatal_error ("Can't open module file %qs for reading at %C: %s", - filename, xstrerror (errno)); + { + if (gfc_state_stack->state != COMP_SUBMODULE + && module->submodule_name == NULL) + gfc_fatal_error ("Can't open module file %qs for reading at %C: %s", + filename, xstrerror (errno)); + else + gfc_fatal_error ("Module file %qs has not been generated, either " + "because the module does not contain a MODULE " + "PROCEDURE or there is an error in the module.", + filename); + } /* Check that we haven't already USEd an intrinsic module with the same name. */ |