[PATCH, Fortran] Extension: Support legacy PARAMETER statements with -std=legacy (or -fdec?)

Jerry DeLisle jvdelisle@charter.net
Thu Nov 3 14:26:00 GMT 2016


On 11/03/2016 04:16 AM, Fritz Reese wrote:
> On Wed, Nov 2, 2016 at 3:38 PM, Jerry DeLisle <jvdelisle@charter.net> wrote:
>> On 11/02/2016 08:47 AM, Fritz Reese wrote:
>>>
>>> Attached is a patch for the GNU Fortran front-end which allows the
>>> compiler to interpret these legacy PARAMETER statements. The patch in
>>> its current form does this without warning through -std=legacy
>>> (warning for -std=gnu, error for -std=f*). Bootstraps and regtests on
>>> x86_64-redhat-linux.
>>
>> How does the behavior compare to G77 current behavior. Often we use
>> -std=legacy to maintain compatibility with G77, so we do not want to break
>> anything there, though I realize we can not be perfect in all cases.
>>
>
> I don't know. I don't have a copy of g77, and the code seems to have
> been successfully scrubbed from the searchable internet.
>
> I can say the Intel Fortran compiler simply accepts these parameter
> statements by default. It will only warn you about it if you give it
> an explicit standard on the command-line, and even then will still
> interpret them as PARAMETER statements. So as far as I can tell,
> legacy compilers would never interpret "parameterblah = ..." as
> assignment to "parameterblah".
>
> ---
> Fritz Reese
>

I am running Fedora here and it has the g77 package which I have installed.

I trimmed down version of dec_parameter_1.f gives:

$ g77 dec_parameter_1.f
dec_parameter_1.f: In subroutine `sub1':
dec_parameter_1.f:10:
              parameter    pi_2 = 3.141592654d0, f_2 = 3.d08
              ^
Unsupported VXT statement at (^)

So with that answered I say your path is OK to commit.

I did get a gfortran.texi hunk failed when applying the patch so maybe check that.

$ patch -p1 <dec_parameter.diff
patching file gcc/fortran/decl.c
patching file gcc/fortran/gfortran.texi
Hunk #1 FAILED at 1472.
Hunk #2 succeeded at 2777 with fuzz 2 (offset 72 lines).
1 out of 2 hunks FAILED -- saving rejects to file gcc/fortran/gfortran.texi.rej
patching file gcc/fortran/parse.c
patching file gcc/testsuite/gfortran.dg/dec_parameter_1.f
patching file gcc/testsuite/gfortran.dg/dec_parameter_2.f90
patching file gcc/testsuite/gfortran.dg/dec_parameter_3.f90
patching file gcc/testsuite/gfortran.dg/dec_parameter_4.f90

Regards,

Jerry




More information about the Fortran mailing list