+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>
* f95-lang.c (gfc_attribute_table): Swap affects_type_identity
if (c == '(')
{
(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;
gfc_gobble_whitespace ();
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:
msg = "TS 29113/TS 18508:";
break;
* Runtime:: Influencing runtime behavior with environment variables.
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.
* Extensions:: Language extensions implemented by GNU Fortran.
* Mixed-Language Programming:: Interoperability with C
@section About GNU Fortran
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
following features:
@itemize @bullet
@item
-Read a user's program,
-stored in a file and containing instructions written
-in Fortran 77, Fortran 90, Fortran 95, Fortran 2003 or Fortran 2008.
-This file contains @dfn{source code}.
+Read a user's program, stored in a file and containing instructions
+written in Fortran 77, Fortran 90, Fortran 95, Fortran 2003, Fortran
+2008 or Fortran 2018. This file contains @dfn{source code}.
@item
Translate the user's program into instructions a computer
regressions.
The primary work remaining to be done on GNU Fortran falls into three
-categories: bug fixing (primarily regarding the treatment of invalid code
-and providing useful error messages), improving the compiler optimizations
-and the performance of compiled code, and extending the compiler to support
-future standards---in particular, Fortran 2003 and Fortran 2008.
+categories: bug fixing (primarily regarding the treatment of invalid
+code and providing useful error messages), improving the compiler
+optimizations and the performance of compiled code, and extending the
+compiler to support future standards---in particular, Fortran 2003,
+Fortran 2008 and Fortran 2018.
@c ---------------------------------------------------------------------
standard-compliant Fortran 90 and Fortran 77 programs. It also supports
the ISO/IEC TR-15581 enhancements to allocatable arrays.
-GNU Fortran also have a partial support for ISO/IEC 1539-1:2004 (Fortran
-2003), ISO/IEC 1539-1:2010 (Fortran 2008), the Technical Specification
-@code{Further Interoperability of Fortran with C} (ISO/IEC TS 29113:2012).
-Full support of those standards and future Fortran standards is planned.
-The current status of the support is can be found in the
-@ref{Fortran 2003 status}, @ref{Fortran 2008 status}, @ref{TS 29113 status}
-and @ref{TS 18508 status} sections of the documentation.
+GNU Fortran also have a partial support for ISO/IEC 1539-1:2004
+(Fortran 2003), ISO/IEC 1539-1:2010 (Fortran 2008), the Technical
+Specification @code{Further Interoperability of Fortran with C}
+(ISO/IEC TS 29113:2012). Full support of those standards and future
+Fortran standards is planned. The current status of the support is
+can be found in the @ref{Fortran 2003 status}, @ref{Fortran 2008
+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
(version 4.0 and most of the features of the 4.5 version,
@end tex
@c ---------------------------------------------------------------------
-@c Fortran 2003 and 2008 Status
+@c Fortran standards status
@c ---------------------------------------------------------------------
-@node Fortran 2003 and 2008 status
-@chapter Fortran 2003 and 2008 Status
+@node Fortran standards status
+@chapter Fortran standards status
@menu
* Fortran 2003 status::
* Fortran 2008 status::
* TS 29113 status::
* TS 18508 status::
+* Fortran 2018 status::
@end menu
@node Fortran 2003 status
@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 Compiler Characteristics
@c ---------------------------------------------------------------------
@section Extensions implemented in GNU Fortran
@cindex extensions, implemented
-GNU Fortran implements a number of extensions over standard
-Fortran. This chapter contains information on their syntax and
-meaning. There are currently two categories of GNU Fortran
-extensions, those that provide functionality beyond that provided
-by any standard, and those that are supported by GNU Fortran
-purely for backward compatibility with legacy compilers. By default,
-@option{-std=gnu} allows the compiler to accept both types of
-extensions, but to warn about the use of the latter. Specifying
-either @option{-std=f95}, @option{-std=f2003} or @option{-std=f2008}
-disables both types of extensions, and @option{-std=legacy} allows both
-without warning. The special compile flag @option{-fdec} enables additional
-compatibility extensions along with those enabled by @option{-std=legacy}.
+GNU Fortran implements a number of extensions over standard Fortran.
+This chapter contains information on their syntax and meaning. There
+are currently two categories of GNU Fortran extensions, those that
+provide functionality beyond that provided by any standard, and those
+that are supported by GNU Fortran purely for backward compatibility
+with legacy compilers. By default, @option{-std=gnu} allows the
+compiler to accept both types of extensions, but to warn about the use
+of the latter. Specifying either @option{-std=f95},
+@option{-std=f2003}, @option{-std=f2008}, or @option{-std=f2018}
+disables both types of extensions, and @option{-std=legacy} allows
+both without warning. The special compile flag @option{-fdec} enables
+additional compatibility extensions along with those enabled by
+@option{-std=legacy}.
@menu
* Old-style kind specifications::
@item @emph{option flag list}:
@multitable @columnfractions .15 .70
@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.
-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}
-(8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (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_F95_OBS | 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_GNU | GFC_STD_LEGACY}.
+if e.g. an input-output edit descriptor is invalid in a given
+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} (8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU}
+(32), @code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128),
+@code{GFC_STD_F2008_OBS} (256), @code{GFC_STD_F2008_TS} (512),
+@code{GFC_STD_F2018} (1024), @code{GFC_STD_F2018_OBS} (2048), and
+@code{GFC_STD=F2018_DEL} (4096). Default: @code{GFC_STD_F95_OBS |
+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
standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
@item @var{option}[2] @tab If non zero, enable pedantic checking.
if (formal->attr.codimension)
{
/* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */
- /* F2015, 12.5.2.8. */
+ /* F2018, 12.5.2.8. */
if (formal->attr.dimension
&& (formal->attr.contiguous || formal->as->type != AS_ASSUMED_SHAPE)
&& actual_attr.dimension
@item -std=@var{std}
@opindex @code{std=}@var{std} option
-Specify the standard to which the program is expected to conform, which
-may be one of @samp{f95}, @samp{f2003}, @samp{f2008}, @samp{gnu}, or
-@samp{legacy}. The default value for @var{std} is @samp{gnu}, which
-specifies a superset of the Fortran 95 standard that includes all of the
-extensions supported by GNU Fortran, although warnings will be given for
-obsolete extensions not recommended for use in new code. The
-@samp{legacy} value is equivalent but without the warnings for obsolete
-extensions, and may be useful for old non-standard programs. The
-@samp{f95}, @samp{f2003} and @samp{f2008} values specify strict
-conformance to the Fortran 95, Fortran 2003 and Fortran 2008 standards,
-respectively; errors are given for all extensions beyond the relevant
-language standard, and warnings are given for the Fortran 77 features
-that are permitted but obsolescent in later standards. @samp{-std=f2008ts}
-allows the Fortran 2008 standard 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.
+Specify the standard to which the program is expected to conform,
+which may be one of @samp{f95}, @samp{f2003}, @samp{f2008},
+@samp{f2018}, @samp{gnu}, or @samp{legacy}. The default value for
+@var{std} is @samp{gnu}, which specifies a superset of the latest
+Fortran standard that includes all of the extensions supported by GNU
+Fortran, although warnings will be given for obsolete extensions not
+recommended for use in new code. The @samp{legacy} value is
+equivalent but without the warnings for obsolete extensions, and may
+be useful for old non-standard programs. The @samp{f95},
+@samp{f2003}, @samp{f2008}, and @samp{f2018} values specify strict
+conformance to the Fortran 95, Fortran 2003, Fortran 2008 and Fortran
+2018 standards, respectively; errors are given for all extensions
+beyond the relevant language standard, and warnings are given for the
+Fortran 77 features that are permitted but obsolescent in later
+standards. @samp{-std=f2008ts} allows the Fortran 2008 standard
+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
@opindex @code{ftest-forall-temp}
@itemx -pedantic
@opindex @code{pedantic}
@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
occur in GNU Fortran source files, such as use of @samp{\e} in a
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.
However, without this option, certain GNU extensions and traditional
Fortran features are supported as well.
However, improvements to GNU Fortran in this area are welcome.
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
@opindex @code{pedantic-errors}
@opindex @code{Wampersand}
@cindex warnings, ampersand
@cindex @code{&}
-Warn about missing ampersand in continued character constants. The warning is
-given with @option{-Wampersand}, @option{-pedantic}, @option{-std=f95},
-@option{-std=f2003} and @option{-std=f2008}. Note: With no ampersand
-given in a continued character constant, GNU Fortran assumes continuation
-at the first non-comment, non-whitespace character after the ampersand
-that initiated the continuation.
+Warn about missing ampersand in continued character constants. The
+warning is given with @option{-Wampersand}, @option{-pedantic},
+@option{-std=f95}, @option{-std=f2003}, @option{-std=f2008} and
+@option{-std=f2018}. Note: With no ampersand given in a continued
+character constant, GNU Fortran assumes continuation at the first
+non-comment, non-whitespace character after the ampersand that
+initiated the continuation.
@item -Wargument-mismatch
@opindex @code{Wargument-mismatch}
@cindex tabulators
By default, tabs are accepted as whitespace, but tabs are not members
of the Fortran Character Set. For continuation lines, a tab followed
-by a digit between 1 and 9 is supported. @option{-Wtabs} will cause
-a warning to be issued if a tab is encountered. Note, @option{-Wtabs}
-is active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003},
-@option{-std=f2008}, @option{-std=f2008ts} and @option{-Wall}.
+by a digit between 1 and 9 is supported. @option{-Wtabs} will cause a
+warning to be issued if a tab is encountered. Note, @option{-Wtabs} is
+active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003},
+@option{-std=f2008}, @option{-std=f2008ts}, @option{-std=f2018} and
+@option{-Wall}.
@item -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.
;
; This file is part of GCC.
Fortran
Conform to the ISO Fortran 2008 standard including TS 29113.
+std=f2018
+Fortran
+Conform to the ISO Fortran 2018 standard.
+
std=f95
Fortran
Conform to the ISO Fortran 95 standard.
Note that no features were obsoleted nor deleted in F2003.
Please remember to keep those definitions in sync with
gfortran.texi. */
-/* For now, use F2015 = GFC_STD_GNU. */
-#define GFC_STD_F2015 (1<<5) /* PLACEHOLDER for Fortran 2015. */
+#define GFC_STD_F2018_DEL (1<<12) /* Deleted in F2018. */
+#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_OBS (1<<8) /* Obsolescent in F2008. */
#define GFC_STD_F2008 (1<<7) /* New in F2008. */
{
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)))
goto cleanup;
}
{
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_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;
}
warn_tabs = 1;
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:
set_default_std_flags ();
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.
! { dg-do compile }
-! { dg-options "-std=gnu" }
+! { dg-options "-std=f2018" }
!
-! F2015 permits ERROR STOP in PURE procedures
-! FIXME: Change to -std=f2015, when available
+! F2018 permits ERROR STOP in PURE procedures
!
pure subroutine foo()
error stop "failed"
! { dg-do compile }
! { dg-options "-std=f2008ts" }
!
-! F2015 permits ERROR STOP in PURE procedures
-! FIXME: Change to error_stop_3.f90 to -std=f2015.
+! F2018 permits ERROR STOP in PURE procedures
!
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
! { dg-do compile }
! { 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)
-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
program spellchekc
- implicit none (external) ! { dg-warning "GNU Extension: IMPORT NONE with spec list" }
+ implicit none (external)
interface
subroutine bark_unless_zero(iarg)