[flang] Fix lowering of array paths in elemental calls
Elemental procedures may need their array arguments to be passed by address. This is done by setting ArrayExprLowering::semant to a value that corresponds to this semantics. Later, member functions such as applyPathToArrayLoad() read this variable to generate FIR instructions that match the needed behavior. The problem is that the semant variable also affects how array paths are lowered. Thus, if an index of the path is an array element, this will cause its address to be used instead of its value, which usually results in a segmentation fault at runtime. Example: b(i:i) = elem_func(a(v(i):v(i))) To fix this, ArrayExprLowering::nextPathSemant was added. When it's set, the next array path is handled with the semantics specified by it, while the elemental argument retains its original semantics. Fixes https://github.com/llvm/llvm-project/issues/62981 Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D153454
Loading
Please sign in to comment