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

--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 58231
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58231&action=edit
Preliminary fix for this PR

I went back to the beginning on this problem, having realised that it is far
too early to resolve the compcall of a class argument in gfc_reduce_init_expr.
Hence the chunk in expr.cc. The second chunk is (possibly) a bit of a kludge
and, I would have thought, should be checked, at very least by checking that
the class extends an abstract type. I will come back to this - yard duty calls!

A reduced test case, without the module 'example' and no type extension also
failed and is now fixed. Also failing in this reduced testcase was:
    function func (this) result (string)
      class(bar) :: this
      character (:), allocatable :: string
      allocate (character(this%size()) :: string)
      string = repeat ("x", len (string))
    end function

Again, this is fixed.

Finally, the patch even regression tests OK :-)

Enough for now.

Paul

Reply via email to