[all-commits] [llvm/llvm-project] c881f3: [flang] Fix lowering of array paths in elemental c...
Leandro Lupori via All-commits
all-commits at lists.llvm.org
Mon Jun 26 05:35:39 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c881f3eb992d59cca35ce42719277ac738719877
https://github.com/llvm/llvm-project/commit/c881f3eb992d59cca35ce42719277ac738719877
Author: Leandro Lupori <leandro.lupori at linaro.org>
Date: 2023-06-26 (Mon, 26 Jun 2023)
Changed paths:
M flang/lib/Lower/ConvertExpr.cpp
A flang/test/Lower/array-elemental-calls-3.f90
Log Message:
-----------
[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
More information about the All-commits
mailing list