mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 15:31:11 +08:00
re PR fortran/50404 (SIGSEGV in gfc_resolve_close)
PR fortran/50404 * io.c (gfc_resolve_close): CLOSE requires a UNIT. * gfortran.dg/io_constraints_3.f90: Improve testcase. From-SVN: r181183
This commit is contained in:
parent
4408b0865b
commit
b35f6a97ab
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -2295,6 +2295,24 @@ gfc_resolve_close (gfc_close *close)
|
||||
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)
|
||||
|
@ -1,7 +1,12 @@
|
||||
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>
|
||||
|
||||
|
@ -66,6 +66,7 @@
|
||||
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" }
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user