[Patch, fortran] PRs 89363 and 89364 - wrinkles with assumed rank
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sun Mar 10 15:27:00 GMT 2019
The attached patch implements fixes for a couple of wrinkles with assumed rank:
(i) PR89363 flagged the fact that the rank was not be set for assumed
rank entities, associated with unallocated or unassociated arrays. The
fix is straightforward, the work being done by
trans-expr.c(set_dtype_for_unallocated).
(ii) PR89364 points out that ubound and shape should be returning -1
for the final dimension and not 0, for assumed rank entities argument
associated with assumed size arrays. The fix for this is bolted on to
both intrinsics. BTW lbound seems lack a bit of fixing of intermediate
expressions - the result is often overwhelmingly complicated. Is there
some reason for this?
Bootstrapped and regtested on FC29/x86_64 - OK for trunk?
Paul
PS I scoped out the select rank construct. It looks well doable but
will have to await 10-branch opening.
2019-03-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/89363
PR fortran/89364
* trans-expr.c (set_dtype_for_unallocated): New function.
(gfc_conv_gfc_desc_to_cfi_desc): Call it for allocatable and
pointer arguments.
(gfc_conv_procedure_call): Likewise. Also, set the ubound of
the final dimension to -1 for assumed rank formal args that are
associated with assumed size arrays.
* trans-intrinsic.c (gfc_conv_intrinsic_bound): Return -1 for
the final dimension of assumed rank entities that are argument
associated with assumed size arrays.
(gfc_conv_intrinsic_shape): Likewise return -1 for the final
dimension of the shape intrinsic.
2019-03-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/89363
* gfortran.dg/assumed_rank_16.f90: New test.
PR fortran/89364
* gfortran.dg/assumed_rank_17.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 11985 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20190310/5e9adafc/attachment.bin>
More information about the Fortran
mailing list