PR fortran/95053 - division by zero constants

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PR fortran/95053 - division by zero constants

Harald Anlauf-3
Here's a new attempt to finally fix this PR and any known fallout.

In order to handle division by zero in declarations, but still accept the
code snippet adapted from 521.wrf_r (from spec2017), I removed the hunk
that was added to fix PR94399, and deferred the handling to a later stage.

One case regarding array shapes is handled in variable_decl in decl.c, the
other one regarding PDTs is handled in gfc_get_pdt_instance in the same
file.  While at it, I improved the error message to notify the user if an
expression that should be of INTEGER type isn't.

Regtests with no new failures on x86_64-pc-linux-gnu, after adjusting
error messages for test dec_structure_23.f90.

OK for trunk?

Thanks,
Harald


PR fortran/95053 - division by zero constants

        Partially revert the fix for PR93499.  Replace by checks for valid
        expressions in the declaration of array shape and PDT KIND and LEN
        expressions at a later stage.

gcc/fortran/

2020-05-15  Harald Anlauf  <[hidden email]>

        PR fortran/95053
        * arith.c (gfc_divide): Revert hunk introduced by patch for
        PR93499.
        * decl.c (variable_decl): Generate error for array shape not being
        an INTEGER constant.
        (gfc_get_pdt_instance): Generate error if KIND or LEN expressions
        in declaration of a PDT instance do not simplify to INTEGER
        constants.

gcc/testsuite/

2020-05-15  Harald Anlauf  <[hidden email]>

        PR fortran/95053
        * gfortran.dg/dec_structure_23.f90: Adjust to new error messages.
        * gfortran.dg/pr95053_2.f90: New test.
        * gfortran.dg/pr95053_3.f90: New test.


pr95053-v2.patch (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PR fortran/95053 - division by zero constants

gcc - fortran mailing list
Am 15.05.20 um 22:33 schrieb Harald Anlauf:

> Here's a new attempt to finally fix this PR and any known fallout.
>
> In order to handle division by zero in declarations, but still accept the
> code snippet adapted from 521.wrf_r (from spec2017), I removed the hunk
> that was added to fix PR94399, and deferred the handling to a later stage.
>
> One case regarding array shapes is handled in variable_decl in decl.c, the
> other one regarding PDTs is handled in gfc_get_pdt_instance in the same
> file.  While at it, I improved the error message to notify the user if an
> expression that should be of INTEGER type isn't.
>
> Regtests with no new failures on x86_64-pc-linux-gnu, after adjusting
> error messages for test dec_structure_23.f90.
>
> OK for trunk?

I think this is a good approach (and a better error message, too).

So, OK, and thanks for the patch!

Regards

        Thomas