aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Frontend/CompilerInvocationTest.cpp
diff options
context:
space:
mode:
authorSlava Zakharin <szakharin@nvidia.com>2023-09-05 10:26:16 -0700
committerGitHub <noreply@github.com>2023-09-05 10:26:16 -0700
commitde8939ffca277670613904872e55a9a4d9f19b94 (patch)
treeb3f8fa6b230d77791b388c387851c0d1dbf5f2cb /clang/unittests/Frontend/CompilerInvocationTest.cpp
parentf0b2f6954101c9052763a99a1e7ac135770e779a (diff)
downloadllvm-de8939ffca277670613904872e55a9a4d9f19b94.zip
llvm-de8939ffca277670613904872e55a9a4d9f19b94.tar.gz
llvm-de8939ffca277670613904872e55a9a4d9f19b94.tar.bz2
[flang] Reset lbounds for allocatable function results. (#65286)
With HLFIR the lbounds for the ALLOCATABLE result are taken from the mutable box created for the result, so the non-default lbounds might be propagated further causing incorrect result, e.g.: ``` program p real, allocatable :: p5(:) allocate(p5, source=real_init()) print *, lbound(p5, 1) ! must print 1, but prints 7 contains function real_init() real, allocatable :: real_init(:) allocate(real_init(7:8)) end function real_init end program p ``` With FIR lowering the box passed for `source` has explicit lower bound 1 at the call site, but the runtime box initialized by `real_init` call still has lower bound 7. I am not sure if the runtime box initialized by `real_init` will ever be accessed in a debugger via Fortran variable names, but I think that having the right runtime bounds that can be accessible via examining registers/stack might be good in general. So I decided to update the runtime bounds at the point of return. This change fixes the test above for HLFIR. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D156187
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
0 files changed, 0 insertions, 0 deletions