https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106684

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 ---
F2018, 7.5.10 Construction of derived-type values

   For a nonpointer component, the declared type and type parameters of the
   component and expr shall conform in the same way as for a variable and
   expr in an intrinsic assignment statement (10.2.1.2).

F2018, 10.2.1.2 Intrinsic assignment statement

   In an intrinsic assignment statement,
   ...
   (3) the variable and expr shall be conformable unless the variable
       is an allocatable array that has the same rank as expr and is
       not a coarray,

F2018:
   3.36
   conformable
   of two data entities having the same shape, or one being an array
   and the other being scalar


% cat a.f90
program p
   implicit none
   a = (/0., 1., 2., 3./)
end program

% gfcx -o z a.f90
a.f90:13:3:

   13 |    a = (/0., 1., 2., 3./)
      |   1
Error: Incompatible ranks 2 and 1 in assignment at (1)


Looks like a bug in your program.  The quoted text is not a numbered constraint
so a Fortran compiler is not required to report an issue.  In this case,
gfortran was able to diagnose an issue in your code.  Simple fix is to use
`reshape([0.,1.,2.,3.],[2.2]) in your constrcutor.

Reply via email to