https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79842
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The patch in comment 4 does not bootstrap:
../../work/gcc/fortran/module.c: In function 'void
gfc_use_module(gfc_use_list*)':
../../work/gcc/fortran/module.c:7145:8: error: suggest explicit braces to avoid
ambiguous 'else' [-Werror=dangling-else]
7145 | if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
| ^
cc1plus: all warnings being treated as errors
This one does
--- ../_clean/gcc/fortran/module.c 2019-03-21 20:46:46.000000000 +0100
+++ gcc/fortran/module.c 2019-04-06 16:39:02.000000000 +0200
@@ -7144,8 +7144,12 @@ gfc_use_module (gfc_use_list *module)
for (p = gfc_state_stack; p; p = p->previous)
if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
&& strcmp (p->sym->name, module_name) == 0)
- gfc_fatal_error ("Cannot USE the same %smodule we're building",
- p->state == COMP_SUBMODULE ? "sub" : "");
+ {
+ if (p->state == COMP_SUBMODULE)
+ gfc_fatal_error ("Cannot USE a submodule that is currently built");
+ else
+ gfc_fatal_error ("Cannot USE a module that is currently built");
+ }
init_pi_tree ();
init_true_name_tree ();