https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95613
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
Priority|P3 |P4
--- Comment #2 from kargl at gcc dot gnu.org ---
Fortran 66 has not been the standard for 54 years. Time to enforce numbered
constraints in the Fortran 2018 (and older) standard.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 280157)
+++ gcc/fortran/resolve.c (working copy)
@@ -10193,12 +10200,16 @@ resolve_branch (gfc_st_label *label, gfc_code *code)
return;
}
- /* The label is not in an enclosing block, so illegal. This was
- allowed in Fortran 66, so we allow it as extension. No
- further checks are necessary in this case. */
- gfc_notify_std (GFC_STD_LEGACY, "Label at %L is not in the same block "
- "as the GOTO statement at %L", &label->where,
- &code->loc);
+ /* F2018: C1169 (R1157) The label shall be the statement label of a
+ branch target statement that appears in the same inclusive scope
+ as the goto-stmt.
+
+ F2018: C1170 (R1158) Each label in label-list shall be the statement
+ label of a branch target statement that appears in the same inclusive
+ scope as the computed-goto-stmt. */
+
+ gfc_error ("Label at %L is not in the same block as the GOTO statement "
+ "at %L", &label->where, &code->loc);
return;
}