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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|diagnostic                  |rejects-valid, wrong-code
                 CC|                            |anlauf at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=107721
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-08-28

--- Comment #2 from anlauf at gcc dot gnu.org ---
It appears that we lose the typespec for nested ctors, so I guess this PR
is related to pr107721.

Slight variation of testcase:

program p
  character    :: x = 'a'
  character(4) :: y(2)
  y = [ character(4) :: x, 'b' ]
  y = [[character(4) :: x, 'b']]
  print *, y
  print *, len ([ character(4) :: x, 'b' ])
  print *, len ([[character(4) :: x, 'b']])
end

Compiling with -fdump-fortran-original, I see:

  code:
  ASSIGN p:y(FULL) (/ p:x , 'b   ' /)
  ASSIGN p:y(FULL) (/ p:x , 'b' /)
  WRITE UNIT=6 FMT=-1
  TRANSFER p:y(FULL)
  DT_END
  WRITE UNIT=6 FMT=-1
  TRANSFER 4
  DT_END
  WRITE UNIT=6 FMT=-1
  TRANSFER 1
  DT_END

Clearly, the code for the lines with nested ctors is wrong.

Reply via email to