diff options
Diffstat (limited to 'libgfortran/io/open.c')
-rw-r--r-- | libgfortran/io/open.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 06ddf7f..e9fb0a7 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -912,6 +912,16 @@ st_open (st_parameter_open *opp) library_end (); return; } + + if (u->s == NULL) + { + unlock_unit (u); + generate_error (&opp->common, LIBERROR_BAD_OPTION, + "Unit number is negative and unit was not already " + "opened with OPEN(NEWUNIT=...)"); + library_end (); + return; + } } if (u == NULL) |