aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/io.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-12-09 23:49:14 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-12-09 23:49:14 +0000
commit72eb8e780fe462a0f5e4f5f2c77cf2a1ff0454d4 (patch)
treecb5f8205498d179ee6a5784f4ee00cfa8758cb08 /gcc/fortran/io.c
parent899b398116b48b9bcc8ab00f56a01569ddd2f554 (diff)
downloadgcc-72eb8e780fe462a0f5e4f5f2c77cf2a1ff0454d4.zip
gcc-72eb8e780fe462a0f5e4f5f2c77cf2a1ff0454d4.tar.gz
gcc-72eb8e780fe462a0f5e4f5f2c77cf2a1ff0454d4.tar.bz2
re PR fortran/88205 (ICE in gfc_wide_strncasecmp, at fortran/scanner.c:249)
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88205 * io.c (gfc_match_open): Move NEWUNIT checks to after STATUS checks. 2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88205 * gfortran.dg/pr88205.f90: New unit. From-SVN: r266936
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r--gcc/fortran/io.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 0aa31bb..8008f92 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -2150,33 +2150,6 @@ gfc_match_open (void)
warn = (open->err || open->iostat) ? true : false;
- /* Checks on NEWUNIT specifier. */
- if (open->newunit)
- {
- if (open->unit)
- {
- gfc_error ("UNIT specifier not allowed with NEWUNIT 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)
- {
- gfc_error ("OPEN statement at %C must have UNIT or NEWUNIT specified");
- goto cleanup;
- }
-
/* Checks on the ACCESS specifier. */
if (open->access && open->access->expr_type == EXPR_CONSTANT)
{
@@ -2501,6 +2474,33 @@ gfc_match_open (void)
}
}
+ /* Checks on NEWUNIT specifier. */
+ if (open->newunit)
+ {
+ if (open->unit)
+ {
+ gfc_error ("UNIT specifier not allowed with NEWUNIT 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)
+ {
+ gfc_error ("OPEN statement at %C must have UNIT or NEWUNIT specified");
+ goto cleanup;
+ }
+
/* Things that are not allowed for unformatted I/O. */
if (open->form && open->form->expr_type == EXPR_CONSTANT
&& (open->delim || open->decimal || open->encoding || open->round