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