Component-by-component assignment must be able to handle unallocated
allocatable values in structure constructor. F2018 7.5.10 p. 7 states
that the component must have unallocated status as a result of such
construction. The structure constructor temporary is initialized
such that all the allocatable components are unallocated, so we just
need to make sure not to do the component assignment if RHS is deallocated.
Depends on D152482 (the same LIT test is affected)
I am commenting on this patch since this is related to ALLOCATABLEs, but this is somehow disconnected: before generating the hlfir.assign op, I think you should call "loadTrivialScalars" on the RHS. We should think this through, but I feel that using pointers/allocatables directly as operands on operations where the allocatable/pointer aspect do not matter will make it harder to express their memory effects via MLIR interface since we will need to express the double read effect on the operand. It may be easier to split the deference.
On the other hand, we could just allow hlfir.assign canonicalization doing that to avoid having to think about this when generating it here and there. And maybe we can actually still easily express the double read effect.