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.
4 files changed