TRANSFER of type with ultimate ALLOCATABLE component

It seems like there are two separate issues here. The first is what is the value of the expression transfer(a,b). I think this could also be written as transfer(a,a), right? I guess the issue is whether the allocatable component of the result is a shallow copy or a deep copy.

Then the second question is what happens with the intrinsic assignment, b=expression. I think this must be a deep copy, regardless of how the first question is answered. So the end result, whether b is a deep copy or a shallow copy, should be the same regardless of how the first question is answered, it should always be a deep copy with a newly allocated component.

If b already had an allocated component prior to the assignment, then the result should always be a deep copy, but whether the existing allocation should be used or whether a newly allocated component should be created has the same ambiguity as any other allocatable assignment as discussed recently in Optimizing vectorized array operations. As you can see in that discussion, there is some disagreement about what the standard says and also whether that was the intended meaning of the intrinsic assignment.