[flang] move ASSOCIATED intrinsic optional TARGET handling
ASSOCIATED intrinsic TARGET handling is weird for OPTIONAL, because as opposed to other intrinsic arguments, OPTIONAL allocatable and pointers may be absent when passed to it, and a diassociated pointer TARGET is not the same as when TARGET is not provided. Hence, it needs custom handling in lowering. The handling was done late (in genIntrinsicCall, without the semantic context), and assumed it would be possible to retrieve the optionality aspects, but this is brittle, and hard to share with HLFIR. Move it in CustomIntrinsicCall that is intended to deal with these corner case. Also avoid using fir.box<None> as the related fir.if result, and used the correct fir.box/fir.class type for the target: using a fir.box<None> here is risky since fir.box<None> are now meant for scalar TYPE(*), and the TARGET may be ranked. Move the introduction of the fir.box<None> around the runtime (when assumed rank are supported, these will become !fir.box<!fir.array<..xNone>>). Differential Revision: https://reviews.llvm.org/D147224
Loading
Please sign in to comment