https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98433
--- Comment #2 from Lionel GUEZ <guez at lmd dot ens.fr> --- Sure, the issue goes away if you specify the components. When you say "the likely correct line", do you imply that the line without the components is incorrect? I would insist that the line without the components is correct. See for example Adams, Fortran 2003 Handbook, 2009, section 7.5.2: "Derived-type intrinsic assignment is performed as if the assignment were expanded, component-by-component with corresponding elements from the variable and the expression, into separate assignment statements. [...] If the component is allocatable: a. if it is allocated, it is deallocated. b. if the corresponding component of the expression is allocated, the variable component is allocated with the same dynamic type and type parameters and, if it is an array, with the same bounds. [...]" gfortran usually implements this well, as we can see when we replace the merge with a simple x3 = x2. But there is something wrong here in gfortran when it encounters the combination of derived-type assignment, merge function, and being in a subroutine. Since the line without the components is valid, the crash is a bug. (I might add that, of course, I produced the simplest possible test case but, in my original program, the allocatable component in the derived type is only one of several components and so, it is not an equivalently satisfying code to manually assign all components one by one.)