[Patch, fortran] PR97694 - ICE with optional assumed rank class(*) argument (and PR97723)

Paul Richard Thomas paul.richard.thomas@gmail.com
Sat Dec 12 10:38:48 GMT 2020


Fortran: Fix some select rank issues [PR97694 and 97723].

Hi All,

Unlike select type, select rank selectors retain the allocatable attribute.
This is corrected by the chunk in check.c. Note the trailing whitespace
corrections. Resolution of select rank construct must be done in the same
way as select type and so the break has been added to ensure that the block
is resolved in resolve_select_rank. The final chunk prevents segfaults for
class associate variables that are optional dummies, since these apparently
are not adorned with the GFC_DECL_SAVED_DESCRIPTOR.

Regtests OK on FC31/x86_64 - OK for master?

Cheers

Paul

2020-12-12  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/97694
PR fortran/97723
* check.c (allocatable_check): Select rank temporaries are
permitted even though they are treated as associate variables.
* resolve.c (gfc_resolve_code): Break on select rank as well as
select type so that the block os resolved.
* trans-stmt.c (trans_associate_var): Class associate variables
that are optional dummies must use the backend_decl.

gcc/testsuite/
PR fortran/97694
PR fortran/97723
* gfortran.dg/select_rank_5.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 3277 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201212/aa8b4772/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: select_rank_5.f90
Type: text/x-fortran
Size: 981 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201212/aa8b4772/attachment-0001.bin>


More information about the Gcc-patches mailing list