https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101199
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tkoenig at gcc dot gnu.org --- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Jürgen Reuter from comment #5) > (In reply to ygal klein from comment #4) > >) > > > > Thank you for the reply. > > > > After posting the bug report - I saw that implementing (inout) as your > > number 1 suggestion - dodges the problem - though as you mentioned having > > inout for this in an init routine is somewhat unnatural. > > > > The 2nd suggestion is something that I was trying to avoid in the first > > place - i.e copying a whole type (this minimal example is a small type - but > > originally it is a type with a lot of instances and procedures) > > > > In fact - I could have had advance as a function that returns a type - but > > then I would be paying the price of copyin assignment of a big type. > > > > Anyway - you conclude that gfortran is behaving as it should and that the > > fact that ifort works - is somewhat a coincidence? > > Let's see what the gfortran developers have to say about this. In any case > it looks strange if you try to call an init routine from a different TBP of > the same object. An init routine is usually called only at the very > instantiation of the object. If you want a shallow copy then you need a > pointer. I can confirm Jürgen's analysis.