Commit 8179b067 by Janne Blomqvist

Support -std=f2018

The Fortran committee has decided to rename the upcoming Fortran 2015
standard to Fortran 2018.  This is not a reflection of a three year
delay in the process, but rather they are following other standards in
adopting the year of publication for the name. For more details see
N2144.

This patch renames GFC_STD_F2015 to GFC_STD_F2018, and makes it a
separate flag rather than an alias for GFC_STD_GNU. Also, it adds a
-std=f2018 argument, and documents it.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2017-12-17  Janne Blomqvist  <jb@gcc.gnu.org>

	* decl.c (gfc_match_implicit_none): Use GFC_STD_F2018 instead of
	GFC_STD_F2015.
	* error.c (gfc_notify_std): Add GFC_STD_F2018{_DEL,_OBS} to
	switch.
	* gfortran.texi: Document -std=f2018.
	* interface.c (compare_parameter): Fix comment.
	* invoke.texi: Document -std=f2018.
	* lang.opt: Add -std=f2018 argumnet.
	* libgfortran.h (GFC_STD_F2015): Rename to GFC_STD_F0218, use
	separate flag bit.
	(GFC_STD_F2018_DEL): New macro.
	(GFC_STD_F2018_OBS): Likewise.
	* match.c (gfc_match_stopcode): Use GFC_STD_F2018.
	* options.c (set_default_std_flags): Add F2018 flags to defaults.
	(gfc_handle_option): Set options for -std=f2018.

gcc/testsuite/ChangeLog:

2017-12-17  Janne Blomqvist  <jb@gcc.gnu.org>

	* gfortran.dg/error_stop_3.f90: Update -std= option, fix comments.
	* gfortran.dg/error_stop_4.f90: Update error message.
	* gfortran.dg/implicit_14.f90: Likewise.
	* gfortran.dg/spellcheck-procedure_2.f90: Don't warn for F2018
	features.

From-SVN: r255761
parent a2ef9558
2017-12-17 Janne Blomqvist <jb@gcc.gnu.org>
* decl.c (gfc_match_implicit_none): Use GFC_STD_F2018 instead of
GFC_STD_F2015.
* error.c (gfc_notify_std): Add GFC_STD_F2018{_DEL,_OBS} to
switch.
* gfortran.texi: Document -std=f2018.
* interface.c (compare_parameter): Fix comment.
* invoke.texi: Document -std=f2018.
* lang.opt: Add -std=f2018 argumnet.
* libgfortran.h (GFC_STD_F2015): Rename to GFC_STD_F0218, use
separate flag bit.
(GFC_STD_F2018_DEL): New macro.
(GFC_STD_F2018_OBS): Likewise.
* match.c (gfc_match_stopcode): Use GFC_STD_F2018.
* options.c (set_default_std_flags): Add F2018 flags to defaults.
(gfc_handle_option): Set options for -std=f2018.
2017-12-15 Jakub Jelinek <jakub@redhat.com> 2017-12-15 Jakub Jelinek <jakub@redhat.com>
* f95-lang.c (gfc_attribute_table): Swap affects_type_identity * f95-lang.c (gfc_attribute_table): Swap affects_type_identity
......
...@@ -4114,7 +4114,7 @@ gfc_match_implicit_none (void) ...@@ -4114,7 +4114,7 @@ gfc_match_implicit_none (void)
if (c == '(') if (c == '(')
{ {
(void) gfc_next_ascii_char (); (void) gfc_next_ascii_char ();
if (!gfc_notify_std (GFC_STD_F2015, "IMPORT NONE with spec list at %C")) if (!gfc_notify_std (GFC_STD_F2018, "IMPORT NONE with spec list at %C"))
return MATCH_ERROR; return MATCH_ERROR;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
......
...@@ -864,6 +864,15 @@ gfc_notify_std (int std, const char *gmsgid, ...) ...@@ -864,6 +864,15 @@ gfc_notify_std (int std, const char *gmsgid, ...)
switch (std) switch (std)
{ {
case GFC_STD_F2018_DEL:
msg = _("Fortran 2018 deleted feature:");
break;
case GFC_STD_F2018_OBS:
msg = _("Fortran 2018 obsolescent feature:");
break;
case GFC_STD_F2018:
msg = _("Fortran 2018:");
break;
case GFC_STD_F2008_TS: case GFC_STD_F2008_TS:
msg = "TS 29113/TS 18508:"; msg = "TS 29113/TS 18508:";
break; break;
......
...@@ -180,7 +180,7 @@ Part I: Invoking GNU Fortran ...@@ -180,7 +180,7 @@ Part I: Invoking GNU Fortran
* Runtime:: Influencing runtime behavior with environment variables. * Runtime:: Influencing runtime behavior with environment variables.
Part II: Language Reference Part II: Language Reference
* Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran. * Fortran standards status:: Fortran 2003, 2008 and 2018 features supported by GNU Fortran.
* Compiler Characteristics:: User-visible implementation details. * Compiler Characteristics:: User-visible implementation details.
* Extensions:: Language extensions implemented by GNU Fortran. * Extensions:: Language extensions implemented by GNU Fortran.
* Mixed-Language Programming:: Interoperability with C * Mixed-Language Programming:: Interoperability with C
...@@ -243,16 +243,15 @@ or alternative to, the Unix @command{f95} command; ...@@ -243,16 +243,15 @@ or alternative to, the Unix @command{f95} command;
@section About GNU Fortran @section About GNU Fortran
The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards
completely, parts of the Fortran 2003 and Fortran 2008 standards, and completely, parts of the Fortran 2003, 2008 and 2018 standards, and
several vendor extensions. The development goal is to provide the several vendor extensions. The development goal is to provide the
following features: following features:
@itemize @bullet @itemize @bullet
@item @item
Read a user's program, Read a user's program, stored in a file and containing instructions
stored in a file and containing instructions written written in Fortran 77, Fortran 90, Fortran 95, Fortran 2003, Fortran
in Fortran 77, Fortran 90, Fortran 95, Fortran 2003 or Fortran 2008. 2008 or Fortran 2018. This file contains @dfn{source code}.
This file contains @dfn{source code}.
@item @item
Translate the user's program into instructions a computer Translate the user's program into instructions a computer
...@@ -504,10 +503,11 @@ G77 can be compiled with GNU Fortran, although there are a few minor known ...@@ -504,10 +503,11 @@ G77 can be compiled with GNU Fortran, although there are a few minor known
regressions. regressions.
The primary work remaining to be done on GNU Fortran falls into three The primary work remaining to be done on GNU Fortran falls into three
categories: bug fixing (primarily regarding the treatment of invalid code categories: bug fixing (primarily regarding the treatment of invalid
and providing useful error messages), improving the compiler optimizations code and providing useful error messages), improving the compiler
and the performance of compiled code, and extending the compiler to support optimizations and the performance of compiled code, and extending the
future standards---in particular, Fortran 2003 and Fortran 2008. compiler to support future standards---in particular, Fortran 2003,
Fortran 2008 and Fortran 2018.
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
...@@ -527,13 +527,14 @@ ISO/IEC 1539:1997 (Fortran 95). As such, it can also compile essentially all ...@@ -527,13 +527,14 @@ ISO/IEC 1539:1997 (Fortran 95). As such, it can also compile essentially all
standard-compliant Fortran 90 and Fortran 77 programs. It also supports standard-compliant Fortran 90 and Fortran 77 programs. It also supports
the ISO/IEC TR-15581 enhancements to allocatable arrays. the ISO/IEC TR-15581 enhancements to allocatable arrays.
GNU Fortran also have a partial support for ISO/IEC 1539-1:2004 (Fortran GNU Fortran also have a partial support for ISO/IEC 1539-1:2004
2003), ISO/IEC 1539-1:2010 (Fortran 2008), the Technical Specification (Fortran 2003), ISO/IEC 1539-1:2010 (Fortran 2008), the Technical
@code{Further Interoperability of Fortran with C} (ISO/IEC TS 29113:2012). Specification @code{Further Interoperability of Fortran with C}
Full support of those standards and future Fortran standards is planned. (ISO/IEC TS 29113:2012). Full support of those standards and future
The current status of the support is can be found in the Fortran standards is planned. The current status of the support is
@ref{Fortran 2003 status}, @ref{Fortran 2008 status}, @ref{TS 29113 status} can be found in the @ref{Fortran 2003 status}, @ref{Fortran 2008
and @ref{TS 18508 status} sections of the documentation. status}, @ref{TS 29113 status}, @ref{TS 18508 status} and @ref{Fortran
2018 status} sections of the documentation.
Additionally, the GNU Fortran compilers supports the OpenMP specification Additionally, the GNU Fortran compilers supports the OpenMP specification
(version 4.0 and most of the features of the 4.5 version, (version 4.0 and most of the features of the 4.5 version,
...@@ -783,17 +784,18 @@ compile option was used. ...@@ -783,17 +784,18 @@ compile option was used.
@end tex @end tex
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
@c Fortran 2003 and 2008 Status @c Fortran standards status
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
@node Fortran 2003 and 2008 status @node Fortran standards status
@chapter Fortran 2003 and 2008 Status @chapter Fortran standards status
@menu @menu
* Fortran 2003 status:: * Fortran 2003 status::
* Fortran 2008 status:: * Fortran 2008 status::
* TS 29113 status:: * TS 29113 status::
* TS 18508 status:: * TS 18508 status::
* Fortran 2018 status::
@end menu @end menu
@node Fortran 2003 status @node Fortran 2003 status
...@@ -1145,6 +1147,27 @@ polymorphic components. ...@@ -1145,6 +1147,27 @@ polymorphic components.
@end itemize @end itemize
@node Fortran 2018 status
@section Status of Fortran 2018 support
So far very little work has been done to support Fortran 2018.
@itemize
@item ERROR STOP in a PURE procedure
An @code{ERROR STOP} statement is permitted in a @code{PURE}
procedure.
@item IMPLICIT NONE with a spec-list
Support the @code{IMPLICIT NONE} statement with an
@code{implicit-none-spec-list}.
@item Behavior of INQUIRE with the RECL= specifier
The behavior of the @code{INQUIRE} statement with the @code{RECL=}
specifier now conforms to Fortran 2018.
@end itemize
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
@c Compiler Characteristics @c Compiler Characteristics
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
...@@ -1482,18 +1505,19 @@ extensions. ...@@ -1482,18 +1505,19 @@ extensions.
@section Extensions implemented in GNU Fortran @section Extensions implemented in GNU Fortran
@cindex extensions, implemented @cindex extensions, implemented
GNU Fortran implements a number of extensions over standard GNU Fortran implements a number of extensions over standard Fortran.
Fortran. This chapter contains information on their syntax and This chapter contains information on their syntax and meaning. There
meaning. There are currently two categories of GNU Fortran are currently two categories of GNU Fortran extensions, those that
extensions, those that provide functionality beyond that provided provide functionality beyond that provided by any standard, and those
by any standard, and those that are supported by GNU Fortran that are supported by GNU Fortran purely for backward compatibility
purely for backward compatibility with legacy compilers. By default, with legacy compilers. By default, @option{-std=gnu} allows the
@option{-std=gnu} allows the compiler to accept both types of compiler to accept both types of extensions, but to warn about the use
extensions, but to warn about the use of the latter. Specifying of the latter. Specifying either @option{-std=f95},
either @option{-std=f95}, @option{-std=f2003} or @option{-std=f2008} @option{-std=f2003}, @option{-std=f2008}, or @option{-std=f2018}
disables both types of extensions, and @option{-std=legacy} allows both disables both types of extensions, and @option{-std=legacy} allows
without warning. The special compile flag @option{-fdec} enables additional both without warning. The special compile flag @option{-fdec} enables
compatibility extensions along with those enabled by @option{-std=legacy}. additional compatibility extensions along with those enabled by
@option{-std=legacy}.
@menu @menu
* Old-style kind specifications:: * Old-style kind specifications::
...@@ -3602,15 +3626,17 @@ used. ...@@ -3602,15 +3626,17 @@ used.
@item @emph{option flag list}: @item @emph{option flag list}:
@multitable @columnfractions .15 .70 @multitable @columnfractions .15 .70
@item @var{option}[0] @tab Allowed standard; can give run-time errors @item @var{option}[0] @tab Allowed standard; can give run-time errors
if e.g. an input-output edit descriptor is invalid in a given standard. if e.g. an input-output edit descriptor is invalid in a given
Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1), standard. Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1),
@code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4), @code{GFC_STD_F95} @code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4),
(8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (32), @code{GFC_STD_F95} (8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU}
@code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128), (32), @code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128),
@code{GFC_STD_F2008_OBS} (256) and GFC_STD_F2008_TS (512). Default: @code{GFC_STD_F2008_OBS} (256), @code{GFC_STD_F2008_TS} (512),
@code{GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F95 | GFC_STD_F2003 @code{GFC_STD_F2018} (1024), @code{GFC_STD_F2018_OBS} (2048), and
| GFC_STD_F2008 | GFC_STD_F2008_TS | GFC_STD_F2008_OBS | GFC_STD_F77 @code{GFC_STD=F2018_DEL} (4096). Default: @code{GFC_STD_F95_OBS |
| GFC_STD_GNU | GFC_STD_LEGACY}. GFC_STD_F95_DEL | GFC_STD_F95 | GFC_STD_F2003 | GFC_STD_F2008 |
GFC_STD_F2008_TS | GFC_STD_F2008_OBS | GFC_STD_F77 | GFC_STD_F2018 |
GFC_STD_F2018_OBS | GFC_STD_F2018_DEL | GFC_STD_GNU | GFC_STD_LEGACY}.
@item @var{option}[1] @tab Standard-warning flag; prints a warning to @item @var{option}[1] @tab Standard-warning flag; prints a warning to
standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}. standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
@item @var{option}[2] @tab If non zero, enable pedantic checking. @item @var{option}[2] @tab If non zero, enable pedantic checking.
......
...@@ -2355,7 +2355,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2355,7 +2355,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (formal->attr.codimension) if (formal->attr.codimension)
{ {
/* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */ /* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */
/* F2015, 12.5.2.8. */ /* F2018, 12.5.2.8. */
if (formal->attr.dimension if (formal->attr.dimension
&& (formal->attr.contiguous || formal->as->type != AS_ASSUMED_SHAPE) && (formal->attr.contiguous || formal->as->type != AS_ASSUMED_SHAPE)
&& actual_attr.dimension && actual_attr.dimension
......
...@@ -467,22 +467,24 @@ representation of the translated Fortran code, produced by ...@@ -467,22 +467,24 @@ representation of the translated Fortran code, produced by
@item -std=@var{std} @item -std=@var{std}
@opindex @code{std=}@var{std} option @opindex @code{std=}@var{std} option
Specify the standard to which the program is expected to conform, which Specify the standard to which the program is expected to conform,
may be one of @samp{f95}, @samp{f2003}, @samp{f2008}, @samp{gnu}, or which may be one of @samp{f95}, @samp{f2003}, @samp{f2008},
@samp{legacy}. The default value for @var{std} is @samp{gnu}, which @samp{f2018}, @samp{gnu}, or @samp{legacy}. The default value for
specifies a superset of the Fortran 95 standard that includes all of the @var{std} is @samp{gnu}, which specifies a superset of the latest
extensions supported by GNU Fortran, although warnings will be given for Fortran standard that includes all of the extensions supported by GNU
obsolete extensions not recommended for use in new code. The Fortran, although warnings will be given for obsolete extensions not
@samp{legacy} value is equivalent but without the warnings for obsolete recommended for use in new code. The @samp{legacy} value is
extensions, and may be useful for old non-standard programs. The equivalent but without the warnings for obsolete extensions, and may
@samp{f95}, @samp{f2003} and @samp{f2008} values specify strict be useful for old non-standard programs. The @samp{f95},
conformance to the Fortran 95, Fortran 2003 and Fortran 2008 standards, @samp{f2003}, @samp{f2008}, and @samp{f2018} values specify strict
respectively; errors are given for all extensions beyond the relevant conformance to the Fortran 95, Fortran 2003, Fortran 2008 and Fortran
language standard, and warnings are given for the Fortran 77 features 2018 standards, respectively; errors are given for all extensions
that are permitted but obsolescent in later standards. @samp{-std=f2008ts} beyond the relevant language standard, and warnings are given for the
allows the Fortran 2008 standard including the additions of the Fortran 77 features that are permitted but obsolescent in later
Technical Specification (TS) 29113 on Further Interoperability of Fortran standards. @samp{-std=f2008ts} allows the Fortran 2008 standard
with C and TS 18508 on Additional Parallel Features in Fortran. including the additions of the Technical Specification (TS) 29113 on
Further Interoperability of Fortran with C and TS 18508 on Additional
Parallel Features in Fortran.
@item -ftest-forall-temp @item -ftest-forall-temp
@opindex @code{ftest-forall-temp} @opindex @code{ftest-forall-temp}
...@@ -782,12 +784,12 @@ other output file. ...@@ -782,12 +784,12 @@ other output file.
@itemx -pedantic @itemx -pedantic
@opindex @code{pedantic} @opindex @code{pedantic}
@opindex @code{Wpedantic} @opindex @code{Wpedantic}
Issue warnings for uses of extensions to Fortran 95. Issue warnings for uses of extensions to Fortran.
@option{-pedantic} also applies to C-language constructs where they @option{-pedantic} also applies to C-language constructs where they
occur in GNU Fortran source files, such as use of @samp{\e} in a occur in GNU Fortran source files, such as use of @samp{\e} in a
character constant within a directive like @code{#include}. character constant within a directive like @code{#include}.
Valid Fortran 95 programs should compile properly with or without Valid Fortran programs should compile properly with or without
this option. this option.
However, without this option, certain GNU extensions and traditional However, without this option, certain GNU extensions and traditional
Fortran features are supported as well. Fortran features are supported as well.
...@@ -799,7 +801,7 @@ nonstandard practices, but not all. ...@@ -799,7 +801,7 @@ nonstandard practices, but not all.
However, improvements to GNU Fortran in this area are welcome. However, improvements to GNU Fortran in this area are welcome.
This should be used in conjunction with @option{-std=f95}, This should be used in conjunction with @option{-std=f95},
@option{-std=f2003} or @option{-std=f2008}. @option{-std=f2003}, @option{-std=f2008} or @option{-std=f2018}.
@item -pedantic-errors @item -pedantic-errors
@opindex @code{pedantic-errors} @opindex @code{pedantic-errors}
...@@ -845,12 +847,13 @@ The following example will trigger the warning. ...@@ -845,12 +847,13 @@ The following example will trigger the warning.
@opindex @code{Wampersand} @opindex @code{Wampersand}
@cindex warnings, ampersand @cindex warnings, ampersand
@cindex @code{&} @cindex @code{&}
Warn about missing ampersand in continued character constants. The warning is Warn about missing ampersand in continued character constants. The
given with @option{-Wampersand}, @option{-pedantic}, @option{-std=f95}, warning is given with @option{-Wampersand}, @option{-pedantic},
@option{-std=f2003} and @option{-std=f2008}. Note: With no ampersand @option{-std=f95}, @option{-std=f2003}, @option{-std=f2008} and
given in a continued character constant, GNU Fortran assumes continuation @option{-std=f2018}. Note: With no ampersand given in a continued
at the first non-comment, non-whitespace character after the ampersand character constant, GNU Fortran assumes continuation at the first
that initiated the continuation. non-comment, non-whitespace character after the ampersand that
initiated the continuation.
@item -Wargument-mismatch @item -Wargument-mismatch
@opindex @code{Wargument-mismatch} @opindex @code{Wargument-mismatch}
...@@ -988,10 +991,11 @@ A @code{CHARACTER} variable is declared with negative length. ...@@ -988,10 +991,11 @@ A @code{CHARACTER} variable is declared with negative length.
@cindex tabulators @cindex tabulators
By default, tabs are accepted as whitespace, but tabs are not members By default, tabs are accepted as whitespace, but tabs are not members
of the Fortran Character Set. For continuation lines, a tab followed of the Fortran Character Set. For continuation lines, a tab followed
by a digit between 1 and 9 is supported. @option{-Wtabs} will cause by a digit between 1 and 9 is supported. @option{-Wtabs} will cause a
a warning to be issued if a tab is encountered. Note, @option{-Wtabs} warning to be issued if a tab is encountered. Note, @option{-Wtabs} is
is active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003}, active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003},
@option{-std=f2008}, @option{-std=f2008ts} and @option{-Wall}. @option{-std=f2008}, @option{-std=f2008ts}, @option{-std=f2018} and
@option{-Wall}.
@item -Wundefined-do-loop @item -Wundefined-do-loop
@opindex @code{Wundefined-do-loop} @opindex @code{Wundefined-do-loop}
......
; Options for the Fortran 95 front end. ; Options for the Fortran front end.
; Copyright (C) 2003-2017 Free Software Foundation, Inc. ; Copyright (C) 2003-2017 Free Software Foundation, Inc.
; ;
; This file is part of GCC. ; This file is part of GCC.
...@@ -802,6 +802,10 @@ std=f2008ts ...@@ -802,6 +802,10 @@ std=f2008ts
Fortran Fortran
Conform to the ISO Fortran 2008 standard including TS 29113. Conform to the ISO Fortran 2008 standard including TS 29113.
std=f2018
Fortran
Conform to the ISO Fortran 2018 standard.
std=f95 std=f95
Fortran Fortran
Conform to the ISO Fortran 95 standard. Conform to the ISO Fortran 95 standard.
......
...@@ -22,8 +22,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -22,8 +22,9 @@ along with GCC; see the file COPYING3. If not see
Note that no features were obsoleted nor deleted in F2003. Note that no features were obsoleted nor deleted in F2003.
Please remember to keep those definitions in sync with Please remember to keep those definitions in sync with
gfortran.texi. */ gfortran.texi. */
/* For now, use F2015 = GFC_STD_GNU. */ #define GFC_STD_F2018_DEL (1<<12) /* Deleted in F2018. */
#define GFC_STD_F2015 (1<<5) /* PLACEHOLDER for Fortran 2015. */ #define GFC_STD_F2018_OBS (1<<11) /* Obsolescent in F2018. */
#define GFC_STD_F2018 (1<<10) /* New in F2018. */
#define GFC_STD_F2008_TS (1<<9) /* POST-F2008 technical reports. */ #define GFC_STD_F2008_TS (1<<9) /* POST-F2008 technical reports. */
#define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */ #define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */
#define GFC_STD_F2008 (1<<7) /* New in F2008. */ #define GFC_STD_F2008 (1<<7) /* New in F2008. */
......
...@@ -2985,7 +2985,7 @@ gfc_match_stopcode (gfc_statement st) ...@@ -2985,7 +2985,7 @@ gfc_match_stopcode (gfc_statement st)
{ {
if (st == ST_ERROR_STOP) if (st == ST_ERROR_STOP)
{ {
if (!gfc_notify_std (GFC_STD_F2015, "%s statement at %C in PURE " if (!gfc_notify_std (GFC_STD_F2018, "%s statement at %C in PURE "
"procedure", gfc_ascii_statement (st))) "procedure", gfc_ascii_statement (st)))
goto cleanup; goto cleanup;
} }
......
...@@ -42,7 +42,8 @@ set_default_std_flags (void) ...@@ -42,7 +42,8 @@ set_default_std_flags (void)
{ {
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
| GFC_STD_F2008_OBS | GFC_STD_F2008_TS | GFC_STD_GNU | GFC_STD_LEGACY; | GFC_STD_F2008_OBS | GFC_STD_F2008_TS | GFC_STD_GNU | GFC_STD_LEGACY
| GFC_STD_F2018 | GFC_STD_F2018_DEL | GFC_STD_F2018_OBS;
gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY; gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
} }
...@@ -741,6 +742,17 @@ gfc_handle_option (size_t scode, const char *arg, int value, ...@@ -741,6 +742,17 @@ gfc_handle_option (size_t scode, const char *arg, int value,
warn_tabs = 1; warn_tabs = 1;
break; break;
case OPT_std_f2018:
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008 | GFC_STD_F2008_OBS
| GFC_STD_F2008_TS | GFC_STD_F2018 | GFC_STD_F2018_OBS;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS
| GFC_STD_F2018_OBS;
gfc_option.max_identifier_length = 63;
warn_ampersand = 1;
warn_tabs = 1;
break;
case OPT_std_gnu: case OPT_std_gnu:
set_default_std_flags (); set_default_std_flags ();
break; break;
......
2017-12-17 Markus Trippelsdorf <markus@trippelsdorf.de> 2017-12-17 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.dg/error_stop_3.f90: Update -std= option, fix comments.
* gfortran.dg/error_stop_4.f90: Update error message.
* gfortran.dg/implicit_14.f90: Likewise.
* gfortran.dg/spellcheck-procedure_2.f90: Don't warn for F2018
features.
2017-12-17 Markus Trippelsdorf <markus@trippelsdorf.de>
* gcc.target/i386/wmul-3.c: New test. * gcc.target/i386/wmul-3.c: New test.
......
! { dg-do compile } ! { dg-do compile }
! { dg-options "-std=gnu" } ! { dg-options "-std=f2018" }
! !
! F2015 permits ERROR STOP in PURE procedures ! F2018 permits ERROR STOP in PURE procedures
! FIXME: Change to -std=f2015, when available
! !
pure subroutine foo() pure subroutine foo()
error stop "failed" error stop "failed"
......
! { dg-do compile } ! { dg-do compile }
! { dg-options "-std=f2008ts" } ! { dg-options "-std=f2008ts" }
! !
! F2015 permits ERROR STOP in PURE procedures ! F2018 permits ERROR STOP in PURE procedures
! FIXME: Change to error_stop_3.f90 to -std=f2015.
! !
pure subroutine foo() pure subroutine foo()
error stop "failed" ! { dg-error "GNU Extension: ERROR STOP statement at .1. in PURE procedure" } error stop "failed" ! { dg-error "Fortran 2018: ERROR STOP statement at .1. in PURE procedure" }
end end
! { dg-do compile } ! { dg-do compile }
! { dg-options "-std=f2008ts" } ! { dg-options "-std=f2008ts" }
! !
! Support Fortran 2015's IMPLICIT NONE with spec list ! Support Fortran 2018's IMPLICIT NONE with spec list
! (currently implemented as vendor extension) ! (currently implemented as vendor extension)
implicit none (type) ! { dg-error "GNU Extension: IMPORT NONE with spec list at \\(1\\)" } implicit none (type) ! { dg-error "Fortran 2018: IMPORT NONE with spec list at \\(1\\)" }
end end
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
program spellchekc program spellchekc
implicit none (external) ! { dg-warning "GNU Extension: IMPORT NONE with spec list" } implicit none (external)
interface interface
subroutine bark_unless_zero(iarg) subroutine bark_unless_zero(iarg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment