[Patch, Fortran] PR 85841: [F2018] reject deleted features

Janus Weil janus@gcc.gnu.org
Sun May 20 17:52:00 GMT 2018


Hi all,

> the attached patch deals with the fact that the Fortran 2018 standard
> marks two features as "deleted" (i.e. no longer supported), namely
> arithmetic IFs and nonblock DO constructs. Both have been obsolescent
> since the 90s (and have been warned about by gfortran with appropriate
> flags).
>
> Here's what the patch does:
> 1) It rejects those features with -std=f2018, giving a hard error.
> 2) It gives a warning with default flags (previously this happened
> only with -std=f2008 etc, but not with -std=gnu).

here is a slightly updated version of the patch. While the previous
one had to duplicate every invocation of gfc_notify_std like this:

if (!gfc_notify_std (GFC_STD_F2018_DEL, ...)) ...
if (!gfc_notify_std (GFC_STD_F95_OBS, ...)) ...

the new version extends gfc_notify_std, such that it works not only
with a single GFC_STD_* flag, but can handle combinations of those.
For such a situation, where a single feature can belong to several
GFC_STD_* classes, one potentially needs to throw different error or
warning messages, depending on the -std= option. The invocation of
gfc_notify_std then simplifies to:

if (!gfc_notify_std (GFC_STD_F95_OBS | GFC_STD_F2018_DEL, ...)) ...

The patch still regtests cleanly. Ok for trunk?

Btw, with the arrival of the F2018 standard, I wonder whether it
actually makes sense to keep the option -std=f2008ts, or to remove it
in favor of -std=f2018, since the two Technical Specifications covered
by this flag are now part of F2018 (and pretty much the main part!).
Any opinions on this?

Cheers,
Janus



2018-05-20  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/85841
    * error.c (notify_std_msg): New function.
    (gfc_notify_std): Adjust such that it can handle combinations of
    GFC_STD_* flags in the 'std' argument, not just a single one.
    * match.c (match_arithmetic_if, gfc_match_if): Reject arithmetic if
    in Fortran 2018.
    (gfc_match_stopcode): Adjust checks for standard version.
    * options.c (set_default_std_flags): Warn for F2018 deleted features
    by default.
    (gfc_handle_option): F2018 deleted features are allowed in earlier
    standards.
    * symbol.c (gfc_define_st_label, gfc_reference_st_label): Reject
    nonblock do constructs in Fortran 2018.


2018-05-20  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/85841
    * gfortran.dg/g77/19990826-3.f: Add option "-std=legacy".
    * gfortran.dg/g77/20020307-1.f: Ditto.
    * gfortran.dg/g77/980310-3.f: Ditto.
    * gfortran.dg/goacc/loop-1-2.f95: Ditto.
    * gfortran.dg/goacc/loop-1.f95: Ditto.
    * gfortran.dg/gomp/appendix-a/a.6.1.f90: Ditto.
    * gfortran.dg/gomp/appendix-a/a.6.2.f90: Ditto.
    * gfortran.dg/gomp/do-1.f90: Ditto.
    * gfortran.dg/gomp/omp_do1.f90: Ditto.
    * gfortran.dg/pr17229.f: Ditto.
    * gfortran.dg/pr37243.f: Ditto.
    * gfortran.dg/pr49721-1.f: Ditto.
    * gfortran.dg/pr58484.f: Ditto.
    * gfortran.dg/pr81175.f: Ditto.
    * gfortran.dg/pr81723.f: Ditto.
    * gfortran.dg/predcom-2.f: Ditto.
    * gfortran.dg/vect/Ofast-pr50414.f90: Ditto.
    * gfortran.dg/vect/cost-model-pr34445a.f: Ditto.
    * gfortran.dg/vect/fast-math-mgrid-resid.f: Ditto.
    * gfortran.dg/vect/pr52580.f: Ditto.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr85841_v2.diff
Type: text/x-patch
Size: 23157 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180520/c41280ab/attachment.bin>


More information about the Gcc-patches mailing list