https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100
Bug ID: 86100 Summary: Spurious error with -fcheck=bounds and allocatable class(*) array components Product: gcc Version: 8.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: neil.n.carlson at gmail dot com Target Milestone: --- When compiled with -fcheck=bounds, the following example gives a spurious runtime bound mismatch error on the 'b=a' assignment statement: type any_matrix class(*), allocatable :: m(:,:) end type type(any_matrix) :: a, b allocate(a%m, source=reshape([3,5],shape=[1,2])) b = a ! SPURIOUS RUNTIME ERROR with -fcheck=bounds end At line 6 of file gfortran-20180610.f90 Fortran runtime error: Array bound mismatch for dimension 1 of array '<<unknown>>' (2/1) Without the -fcheck=bounds option the assignment executes correctly (checked via adding code to examine b%m). There are no problems if the array component is rank-1, or if it is declared integer instead of class(*). So this issue seems confined to allocatable class(*) components of rank 2 (or greater?)