https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104927
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- A sure that code is invalid. F2018, p. 92. The type declaration statement also specifies the attributes whose keywords appear in the attr-spec, except that the DIMENSION attribute can be specified or overridden for an entity by the appearance of array-spec in its entity-decl, ... Modifying your code to program test_invalid_shape implicit none integer, dimension(3,3) :: a(4) integer, dimension(3) :: b(2,2) integer, dimension(3,3) :: c(6,6) print *, 'shape(a) = ',shape(a) print *, 'shape(b) = ',shape(b) print *, 'shape(c) = ',shape(c) end program test_invalid_shape gives shape(a) = 4 shape(b) = 2 2 shape(c) = 6 6 which is in line with the words from the Fortran standard.