diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2021-09-19 17:32:03 -0700 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2021-09-22 17:10:57 -0700 |
commit | 7a40f2e74815a926c5f47416c29efbc17aa1ef43 (patch) | |
tree | 238a5383e85a53e0a48351506c0a2fc9aeb8106e /gcc/fortran/check.c | |
parent | 8fa9e73e6db0ff05447f5547df925fdcb4733d05 (diff) | |
download | gcc-7a40f2e74815a926c5f47416c29efbc17aa1ef43.zip gcc-7a40f2e74815a926c5f47416c29efbc17aa1ef43.tar.gz gcc-7a40f2e74815a926c5f47416c29efbc17aa1ef43.tar.bz2 |
Fortran: Fixes for F2018 C838 (PR fortran/101334)
The compiler was failing to diagnose the error required by F2018 C838
when passing an assumed-rank array argument to a non-assumed-rank dummy.
It was also incorrectly giving an error for calls to the 2-argument form
of the ASSOCIATED intrinsic, which is supposed to be permitted by C838.
2021-09-19 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/101334
gcc/fortran/
* check.c (gfc_check_associated): Allow an assumed-rank
array for the pointer argument.
* interface.c (compare_parameter): Also give rank mismatch
error on assumed-rank array.
gcc/testsuite/
* gfortran.dg/c-interop/c535b-2.f90: Remove xfails.
* gfortran.dg/c-interop/c535b-3.f90: Likewise.
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 851af1b..f31ad68 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -1520,7 +1520,9 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr *target) t = true; if (!same_type_check (pointer, 0, target, 1, true)) t = false; - if (!rank_check (target, 0, pointer->rank)) + /* F2018 C838 explicitly allows an assumed-rank variable as the first + argument of intrinsic inquiry functions. */ + if (pointer->rank != -1 && !rank_check (target, 0, pointer->rank)) t = false; if (target->rank > 0) { |