This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Missing format labels
- From: Paul Brook <paul at nowt dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 7 Sep 2003 19:06:31 +0100
- Subject: [gfortran] Missing format labels
Attached patch generates an error rather than an ICE if a FORMAT label is
referenced but not defined.
Paul
2003-09-07 Paul Brook <paul@nowt.org>
* io.c (gfc_resolve_dt): Error if format label is not defined.
diff -urpxCVS clean/tree-ssa/gcc/fortran/io.c gcc/gcc/fortran/io.c
--- clean/tree-ssa/gcc/fortran/io.c 2003-08-02 01:25:05.000000000 +0100
+++ gcc/gcc/fortran/io.c 2003-09-07 18:55:53.000000000 +0100
@@ -1675,6 +1675,14 @@ gfc_resolve_dt (gfc_dt * dt)
if (gfc_reference_st_label (dt->eor, ST_LABEL_TARGET) == FAILURE)
return FAILURE;
+ /* Check the format label ectually exists. */
+ if (dt->format_label && dt->format_label != &format_asterisk
+ && dt->format_label->defined == ST_LABEL_UNKNOWN)
+ {
+ gfc_error ("FORMAT label %d at %L not defined", dt->format_label->value,
+ &dt->format_label->where);
+ return FAILURE;
+ }
return SUCCESS;
}