Fortran: validate shape of arrays in constructors against declarations

gcc/fortran/ChangeLog:

	PR fortran/102685
	* decl.c (match_clist_expr): Set rank/shape of clist initializer
	to match LHS.
	* resolve.c (resolve_structure_cons): In a structure constructor,
	compare shapes of array components against declared shape.

gcc/testsuite/ChangeLog:

	PR fortran/102685
	* gfortran.dg/derived_constructor_char_1.f90: Fix invalid code.
	* gfortran.dg/pr70931.f90: Likewise.
	* gfortran.dg/transfer_simplify_2.f90: Likewise.
	* gfortran.dg/pr102685.f90: New test.

Co-authored-by: Tobias Burnus <tobias@codesourcery.com>
6 files changed