aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r--gcc/fortran/io.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 8415df1..9c3e689 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -2849,22 +2849,21 @@ cleanup:
bool
-gfc_resolve_filepos (gfc_filepos *fp)
+gfc_resolve_filepos (gfc_filepos *fp, locus *where)
{
RESOLVE_TAG (&tag_unit, fp->unit);
RESOLVE_TAG (&tag_iostat, fp->iostat);
RESOLVE_TAG (&tag_iomsg, fp->iomsg);
- if (!gfc_reference_st_label (fp->err, ST_LABEL_TARGET))
- return false;
- if (!fp->unit && (fp->iostat || fp->iomsg))
+ if (!fp->unit && (fp->iostat || fp->iomsg || fp->err))
{
- locus where;
- where = fp->iostat ? fp->iostat->where : fp->iomsg->where;
- gfc_error ("UNIT number missing in statement at %L", &where);
+ gfc_error ("UNIT number missing in statement at %L", where);
return false;
}
+ if (!gfc_reference_st_label (fp->err, ST_LABEL_TARGET))
+ return false;
+
if (fp->unit->expr_type == EXPR_CONSTANT
&& fp->unit->ts.type == BT_INTEGER
&& mpz_sgn (fp->unit->value.integer) < 0)