https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69910

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot 
gnu.org

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Patch being tested:

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)

Reply via email to