https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106684
--- Comment #6 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Fri, Aug 19, 2022 at 07:16:21PM +0000, j...@bolding-bruggeman.com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106684 > > --- Comment #5 from Jorn Bruggeman <j...@bolding-bruggeman.com> --- > Thanks; it does look like older gfortran versions (and ifort) are too > forgiving > here, and that, given the F2018 definition of "conformable", the latest > gfortran releases are correct. > > As for "stand-alone" variables, I just means regular variables (i.e., not a > component of a derived type). What surprised me is that this still compiles > fine in latest gfortran versions: > > program p > implicit none > > real :: a(2,2) > data a /0., 1., 2., 3./ > end program > > with the data assigned to "a" seemingly being of rank 1. However, this seems > to > work because the rules governing "data" statements for arrays explicitly > describe the target elements ("a") being unpacked in array order, and the > total > number of values having to match. > > Conversely, this is [correctly] rejected by the latest gfortran versions: > > program p > implicit none > > real :: a(2,2) = (/0., 1., 2., 3./) > end program > > All in all, I accept this change in 10.4 and 11.3 was not a bug but an > improvement. It unfortunately does mean that the code (not my own, but one I > depend on) will need changes in >100 places... > I see. I suspect we're seeing mixing of old FORTRAN 77 and the new fangle Fortran. DATA statements go back to at leaset F77 (if not F66, to lazy to check). F2018: 8.6.7 DATA statement The data-stmt-object-list is expanded to form a sequence of pointers and scalar variables, referred to as "sequence of variables" in subsequent text. A nonpointer array whose unqualified name appears as a data-stmt-object or data-i-do-object is equivalent to a complete sequence of its array elements in array element order (9.5.3.2). If there's no onjection I'll close this with INVALID.