* io.c (gfc_resolve_close): CLOSE requires a UNIT.
* gfortran.dg/io_constraints_3.f90: Improve testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181183
138bc75d-0d04-0410-961f-
82ee72b054a4
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+ PR fortran/50404
+ * io.c (gfc_resolve_close): CLOSE requires a UNIT.
+
+2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
PR fortran/50409
* expr.c (gfc_simplify_expr): Substrings can't have negative
length.
if (gfc_reference_st_label (close->err, ST_LABEL_TARGET) == FAILURE)
return FAILURE;
+ if (close->unit == NULL)
+ {
+ /* Find a locus from one of the arguments to close, when UNIT is
+ not specified. */
+ locus loc = gfc_current_locus;
+ if (close->status)
+ loc = close->status->where;
+ else if (close->iostat)
+ loc = close->iostat->where;
+ else if (close->iomsg)
+ loc = close->iomsg->where;
+ else if (close->err)
+ loc = close->err->where;
+
+ gfc_error ("CLOSE statement at %L requires a UNIT number", &loc);
+ return FAILURE;
+ }
+
if (close->unit->expr_type == EXPR_CONSTANT
&& close->unit->ts.type == BT_INTEGER
&& mpz_sgn (close->unit->value.integer) < 0)
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+ PR fortran/50404
+ * gfortran.dg/io_constraints_3.f90: Improve testcase.
+
+2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
PR fortran/50409
- * gcc/testsuite/gfortran.dg/string_5.f90: Improve testcase.
+ * gfortran.dg/string_5.f90: Improve testcase.
2011-10-23 Jason Merrill <jason@redhat.com>
close(10, iostat=u,status="keep")
close(10, iostat=u,status="delete")
close(10, iostat=u,status=foo) ! { dg-warning "STATUS specifier in CLOSE statement" }
+ close(iostat=u) ! { dg-error "requires a UNIT number" }