https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Paul Thomas from comment #7) > Created attachment 58231 [details] > 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 I just noticed that the version on my tree has expr guarded in the additional condition in gfc_reduce_init_expr. Otherwise gfortran.dg/pr103588.f90 segfaults. Paul