diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2020-12-27 14:59:38 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2020-12-27 14:59:38 +0000 |
commit | c4a678981572c12d158709ace0d3f23dd04cf217 (patch) | |
tree | cffb9058bee31e22736a501bf2f63f0c2a53f363 /gcc/fortran/check.c | |
parent | 0e283e2c9f15d8abfd6a57c05d0845f8c4e08827 (diff) | |
download | gcc-c4a678981572c12d158709ace0d3f23dd04cf217.zip gcc-c4a678981572c12d158709ace0d3f23dd04cf217.tar.gz gcc-c4a678981572c12d158709ace0d3f23dd04cf217.tar.bz2 |
Fortran: Fix some select rank issues [PR97694 and 97723].
2020-12-27 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.
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 1e64fab..d8829e4 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -289,7 +289,7 @@ bin2real (gfc_expr *x, int kind) } -/* Fortran 2018 treats a BOZ as simply a string of bits. gfc_boz2real () +/* Fortran 2018 treats a BOZ as simply a string of bits. gfc_boz2real () converts the string into a REAL of the appropriate kind. The treatment of the sign bit is processor dependent. */ @@ -377,12 +377,12 @@ gfc_boz2real (gfc_expr *x, int kind) } -/* Fortran 2018 treats a BOZ as simply a string of bits. gfc_boz2int () +/* Fortran 2018 treats a BOZ as simply a string of bits. gfc_boz2int () converts the string into an INTEGER of the appropriate kind. The treatment of the sign bit is processor dependent. If the converted value exceeds the range of the type, then wrap-around semantics are applied. */ - + bool gfc_boz2int (gfc_expr *x, int kind) { @@ -975,7 +975,8 @@ allocatable_check (gfc_expr *e, int n) symbol_attribute attr; attr = gfc_variable_attr (e, NULL); - if (!attr.allocatable || attr.associate_var) + if (!attr.allocatable + || (attr.associate_var && !attr.select_rank_temporary)) { gfc_error ("%qs argument of %qs intrinsic at %L must be ALLOCATABLE", gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, @@ -3232,7 +3233,7 @@ gfc_check_intconv (gfc_expr *x) || strcmp (gfc_current_intrinsic, "long") == 0) { gfc_error ("%qs intrinsic subprogram at %L has been deprecated. " - "Use INT intrinsic subprogram.", gfc_current_intrinsic, + "Use INT intrinsic subprogram.", gfc_current_intrinsic, &x->where); return false; } @@ -3965,7 +3966,7 @@ gfc_check_findloc (gfc_actual_arglist *ap) /* Check the kind of the characters argument match. */ if (a1 && v1 && a->ts.kind != v->ts.kind) goto incompat; - + d = ap->next->next->expr; m = ap->next->next->next->expr; k = ap->next->next->next->next->expr; |