]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Fix testcases that violate C838, + revealed ICE
authorSandra Loosemore <sandra@codesourcery.com>
Thu, 23 Sep 2021 00:24:58 +0000 (17:24 -0700)
committerSandra Loosemore <sandra@codesourcery.com>
Thu, 23 Sep 2021 00:24:58 +0000 (17:24 -0700)
commite05c54b1d4e113b06f1208b99f999279310e78f8
tree86d369a622f612951b1b017778af53900716bb91
parent1310dd217a12b26fdf30288564accd31fbd28b73
Fortran: Fix testcases that violate C838, + revealed ICE

The three test cases fixed in this patch violated F2018 C838, which
only allows passing an assumed-rank argument to an assumed-rank dummy.
Wrapping the call in "select rank" revealed a null pointer dereference
which is fixed by guarding the use of the result of
GFC_DECL_SAVED_DESCRIPTOR similar to what is already done elsewhere.

2021-09-19  Sandra Loosemore  <sandra@codesourcery.com>

gcc/fortran/
* trans-stmt.c (trans_associate_var): Check that result of
GFC_DECL_SAVED_DESCRIPTOR is not null before using it.

gcc/testsuite/
* gfortran.dg/assumed_rank_18.f90 (g): Wrap call to h in
select rank.
* gfortran.dg/assumed_type_10.f90 (test_array): Likewise for
call to test_lib.
* gfortran.dg/assumed_type_11.f90 (test_array): Likewise.

(cherry picked from commit 8fa9e73e6db0ff05447f5547df925fdcb4733d05)
gcc/fortran/ChangeLog.omp
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gfortran.dg/assumed_rank_18.f90
gcc/testsuite/gfortran.dg/assumed_type_10.f90
gcc/testsuite/gfortran.dg/assumed_type_11.f90