[PATCH, Fortran] Four small DEC extensions

Fritz Reese fritzoreese@gmail.com
Mon Oct 24 14:34:00 GMT 2016


https://gcc.gnu.org/ml/fortran/2016-10/msg00087.html et. al.
> On 12/10/16 13:30, Fritz Reese wrote:
>> Here I submit for review four small extensions to the GNU Fortran
>> frontend for compatibility with legacy code. I figure it might be a
>> nice change of pace from my larger patches. Never fear, for I have
>> more large patches to come, which I will continue to submit
>> one-at-a-time.

Sorry I took a break from this last week. Back on it this week. I
really hope I can get the rest of my major extensions in before the
next release stage, which is apparently imminent, so I might have an
overwhelming number of submissions this week...

Here's how I'm thinking of the flags situation: we use -std=legacy for
old compatibility stuff that users shouldn't use, and -fdec for
ancient compatibility stuff that users _really_ shouldn't use. So if a
user wants the compiler to mimic an old DEC compiler they hit -fdec
and get -std=legacy and all the bells and whistles of the
deleted/obsolete/compatibility extensions without question. Otherwise
they can just use -std=legacy for a more reasonable compilation, or
-std=gnu for some such extensions with reasonable warnings.

Anyway, here's a resubmission of the several patches for the four
extensions mentioned previously, plus an initial cleanup patch for
-fdec. Sorry to pork-barrel the cleanup patch in here, but it combines
some stuff I've been meaning to touch up with the change of making
-fdec into flag_dec using Fortran Var. (This is necessary for the
type-print and future extensions to be enabled with -fdec without
their own flag.)

To summarize, we have
0001 Cleanup -fdec: rolls some options in with fdec that were
documented as being a part of it previously (-fdollar-ok,
-fcray-pointer, -fd-lines-as-comments, legacy/deleted/obsolete feature
standard bits) and moves fdec-structure out of gfc_option to use
Fortran Var.
0002 [always] Form feed: feed characters ('\f') accepted as whitespace in source
0003 [-fdec] TYPE is an alias for PRINT
0004 [-std=legacy] %LOC() can be used as an rval (like the LOC() intrinsic)
0005 [-std=legacy] Support for .XOR. operator (same as .NEQV.)

The -std=legacy extensions of course compile clean with -std=legacy,
give warnings with-std=gnu, and give errors with -std=f*.

OK for trunk now? (regtests x86_64-redhat-linux)

---
Fritz Reese

==> 0001-Cleanup-fdec.patch <==
>From e2563d592af111c7f67ea7f3e41cf6b83d294b1e Mon Sep 17 00:00:00 2001
From: Fritz Reese <fritzoreese@gmail.com>
Date: Mon, 24 Oct 2016 09:56:11 -0400
Subject: [PATCH 1/5] Cleanup -fdec.

        gcc/fortran/
        * invoke.texi, gfortran.texi: Touch up documentation of -fdec.
        * gfortran.h (gfc_option): Move flag_dec_structure out of gfc_option.
        * decl.c (match_record_decl, gfc_match_decl_type_spec,
        gfc_match_structure_decl): Ditto.
        * match.c (gfc_match_member_sep): Ditto.
        * options.c (gfc_handle_option): Ditto.
        * lang.opt (fdec-structure): Use Fortran Var for flag_dec_structure.
        * lang.opt (fdec): Use Fortran Var to create flag_dec.
        * options.c (set_dec_flags): With -fdec enable -fcray-pointer,
        -fd-lines-as-comments (default), and legacy/deleted/obsolete standards.

==> 0002-Treat-form-feed-as-whitespace.patch <==
>From d771dd0e49c30498b6dbd94e1edc3689b5a5cab3 Mon Sep 17 00:00:00 2001
From: Fritz Reese <fritzoreese@gmail.com>
Date: Mon, 17 Oct 2016 08:44:27 -0400
Subject: [PATCH 2/5] Treat form feed as whitespace.

        gcc/fortran/
        * gfortran.texi: Document.
        * gfortran.h (gfc_is_whitespace): Include form feed ('\f').

        gcc/testsuite/gfortran.dg/
        * feed_1.f90, feed_2.f90: New testcases.

==> 0003-Support-TYPE-as-alias-for-PRINT-with-fdec.patch <==
>From 3a26fbde4ace44b3565872f84c2f2dfcec813cb8 Mon Sep 17 00:00:00 2001
From: Fritz Reese <fritzoreese@gmail.com>
Date: Mon, 24 Oct 2016 09:56:53 -0400
Subject: [PATCH 3/5] Support TYPE as alias for PRINT with -fdec.

        gcc/fortran/
        * decl.c (gfc_match_type): New function.
        * match.h (gfc_match_type): New function.
        * match.c (gfc_match_if): Special case for one-line IFs.
        * gfortran.texi: Update documentation.
        * parse.c (decode_statement): Invoke gfc_match_type.

        gcc/testsuite/gfortran.dg/
        * dec_type_print.f90: New testcase.

==> 0004-Enable-LOC-as-an-rvalue-with-std-legacy.patch <==
>From 965d3a0f3dfd4597ce5c1108bb75141e95dd1fbc Mon Sep 17 00:00:00 2001
From: Fritz Reese <fritzoreese@gmail.com>
Date: Mon, 24 Oct 2016 09:46:58 -0400
Subject: [PATCH 4/5] Enable %LOC as an rvalue with -std=legacy.

        gcc/fortran/
        * primary.c (gfc_match_rvalue): Match %LOC as LOC with -std=legacy.
        * gfortran.texi: Document.

        gcc/testsuite/gfortran.dg/
        * dec_loc_rval_1.f90, dec_loc_rval_2.f90, dec_loc_rval_3.f90: New.

==> 0005-Enable-.XOR.-operator-with-std-legacy.patch <==
>From 72f1ffbd6d7d277b212aa5265b439c87a644cb55 Mon Sep 17 00:00:00 2001
From: Fritz Reese <fritzoreese@gmail.com>
Date: Mon, 24 Oct 2016 09:50:22 -0400
Subject: [PATCH 5/5] Enable .XOR. operator with -std=legacy.

        gcc/fortran/
        * gfortran.texi: Document.
        * match.c (gfc_match_intrinsic_op): Match ".XOR." with -std=legacy.

        gcc/testsuite/gfortran.dg/
        * dec_logical_xor_1.f90, dec_logical_xor_2.f90, dec_logical_xor_3.f90:
        New testsuites.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Cleanup-fdec.patch
Type: text/x-patch
Size: 5670 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161024/edf3a3cb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Treat-form-feed-as-whitespace.patch
Type: text/x-patch
Size: 2486 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161024/edf3a3cb/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Support-TYPE-as-alias-for-PRINT-with-fdec.patch
Type: text/x-patch
Size: 7598 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161024/edf3a3cb/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Enable-LOC-as-an-rvalue-with-std-legacy.patch
Type: text/x-patch
Size: 3386 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161024/edf3a3cb/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Enable-.XOR.-operator-with-std-legacy.patch
Type: text/x-patch
Size: 3982 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161024/edf3a3cb/attachment-0004.bin>


More information about the Fortran mailing list