diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2016-02-27 19:07:13 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2016-02-27 19:07:13 +0000 |
commit | dd1291e050cf44de57036bf76ca9f226ce0fc300 (patch) | |
tree | c686964239be3631c430037ede762ee23acb2c54 /gcc/fortran | |
parent | 5cfefb592a4f0c63d683569015c44ad52a82542d (diff) | |
download | gcc-dd1291e050cf44de57036bf76ca9f226ce0fc300.zip gcc-dd1291e050cf44de57036bf76ca9f226ce0fc300.tar.gz gcc-dd1291e050cf44de57036bf76ca9f226ce0fc300.tar.bz2 |
re PR fortran/69910 (ICE with NEWUNIT)
2016-02-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69110
* io.c (gfc_match_open): Check that open status is an expression
constant before comparing string to 'scratch' with NEWUNIT.
* gfortran.dg/newunit_4.f90: New test.
Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r233782
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/io.c | 17 |
2 files changed, 17 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5f1bc4f..80ec195 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2016-02-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/69110 + * io.c (gfc_match_open): Check that open status is an expression + constant before comparing string to 'scratch' with NEWUNIT. + 2016-02-27 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> * trans.c (gfc_allocate_allocatable): size conversion diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index fddd36b..da0e1c5 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -1890,13 +1890,16 @@ gfc_match_open (void) goto cleanup; } - if (!(open->file || (open->status - && gfc_wide_strncasecmp (open->status->value.character.string, - "scratch", 7) == 0))) - { - gfc_error ("NEWUNIT specifier must have FILE= " - "or STATUS='scratch' at %C"); - goto cleanup; + if (!open->file && open->status) + { + if (open->status->expr_type == EXPR_CONSTANT + && gfc_wide_strncasecmp (open->status->value.character.string, + "scratch", 7) != 0) + { + gfc_error ("NEWUNIT specifier must have FILE= " + "or STATUS='scratch' at %C"); + goto cleanup; + } } } else if (!open->unit) |