Blame SOURCES/0006-Allow-blank-format-items-in-format-strings.patch

840d93
From f50b0452c10d514860e08e1ea091b17aa97d6a90 Mon Sep 17 00:00:00 2001
840d93
From: Jim MacArthur <jim.macarthur@codethink.co.uk>
840d93
Date: Thu, 4 Feb 2016 16:59:41 +0000
840d93
Subject: [PATCH 06/23] Allow blank format items in format strings
840d93
840d93
This has to be written in a slightly verbose manner because GCC 7
840d93
defaults to building with -Werror=implicit-fallthrough which prevents
840d93
us from just falling through to the default: case.
840d93
840d93
This feature is enabled by the `-std=extra-legacy` compiler flag.
840d93
---
840d93
        0006-Allow-blank-format-items-in-format-strings.patch
840d93
840d93
commit 8e205f3940a364318d0cd2197a9897142632b336
840d93
Author: Jim MacArthur <jim.macarthur@codethink.co.uk>
840d93
Date:   Thu Feb 4 16:59:41 2016 +0000
840d93
840d93
    Allow blank format items in format strings
840d93
    
840d93
    This has to be written in a slightly verbose manner because GCC 7
840d93
    defaults to building with -Werror=implicit-fallthrough which prevents
840d93
    us from just falling through to the default: case.
840d93
    
840d93
    This feature is enabled by the `-std=extra-legacy` compiler flag.
840d93
    
840d93
    Test written by: Francisco Redondo Marchena <francisco.marchena@codethink.co.uk>
840d93
840d93
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
840d93
index 0bec4ee39b2..d93dcfadd61 100644
840d93
--- a/gcc/fortran/io.c
840d93
+++ b/gcc/fortran/io.c
840d93
@@ -752,6 +752,16 @@ format_item_1:
840d93
       error = unexpected_end;
840d93
       goto syntax;
840d93
 
840d93
+    case FMT_RPAREN:
840d93
+      /* Oracle allows a blank format item. */
840d93
+      if (gfc_option.allow_std & GFC_STD_EXTRA_LEGACY)
840d93
+        goto finished;
840d93
+      else
840d93
+	{
840d93
+	  error = unexpected_element;
840d93
+	  goto syntax;
840d93
+	}
840d93
+
840d93
     default:
840d93
       error = unexpected_element;
840d93
       goto syntax;
840d93
diff --git a/gcc/testsuite/gfortran.dg/dec_format_empty_item.f b/gcc/testsuite/gfortran.dg/dec_format_empty_item.f
840d93
new file mode 100644
840d93
index 00000000000..e817001e38a
840d93
--- /dev/null
840d93
+++ b/gcc/testsuite/gfortran.dg/dec_format_empty_item.f
840d93
@@ -0,0 +1,16 @@
840d93
+! { dg-do compile }
840d93
+! { dg-options "-std=extra-legacy" }
840d93
+!
840d93
+! Test blank/empty format items in format string
840d93
+!
840d93
+        PROGRAM blank_format_items
840d93
+          INTEGER A/0/
840d93
+
840d93
+          OPEN(1, status="scratch")
840d93
+          WRITE(1, 10) 100
840d93
+          REWIND(1)
840d93
+          READ(1, 10) A
840d93
+          IF (a.NE.100) STOP 1
840d93
+          PRINT 10, A
840d93
+10        FORMAT( I5,)
840d93
+        END