]> gcc.gnu.org Git - gcc.git/commit
Fortran: validate shape of arrays in constructors against declarations
authorHarald Anlauf <anlauf@gmx.de>
Fri, 15 Oct 2021 19:23:17 +0000 (21:23 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Sun, 7 Nov 2021 20:40:35 +0000 (21:40 +0100)
commitb1cab51131ad4d5501bf3f01e694704142a10c1a
tree82ab74ba48314a2355364a8881f291e48c2a1541
parentdb1da3d37e33b0adcd7fed68cfdb96e8ee265ccf
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>
(cherry picked from commit 1e819bd95ebeefc1dc469daa1855ce005cb77822)
gcc/fortran/decl.c
gcc/fortran/resolve.c
gcc/testsuite/gfortran.dg/derived_constructor_char_1.f90
gcc/testsuite/gfortran.dg/pr102685.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr70931.f90
gcc/testsuite/gfortran.dg/transfer_simplify_2.f90
This page took 0.068642 seconds and 6 git commands to generate.