aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorSlava Zakharin <szakharin@nvidia.com>2023-05-24 11:18:43 -0700
committerSlava Zakharin <szakharin@nvidia.com>2023-05-24 12:00:20 -0700
commit0daa80e856152ed3250e2925195098f436531ce9 (patch)
tree13192557e8c042ab1ae5b45a61ad9fa869a372aa /clang/lib/Basic/SourceManager.cpp
parent29cb080c363d655ab1179a5564f1a82460e49a06 (diff)
downloadllvm-0daa80e856152ed3250e2925195098f436531ce9.zip
llvm-0daa80e856152ed3250e2925195098f436531ce9.tar.gz
llvm-0daa80e856152ed3250e2925195098f436531ce9.tar.bz2
[flang][hlfir] Create temporary for passing constant expression for actual arg.
Even though the constant expression actual argument is not definable, and the associated dummy argument is not definable, the compiler may produce implicit copies into the memory storage associated with the constant expression. For example, a constant expression storage passed by reference to a subprogram may be used for implicit copy-out: ``` subroutine sub(i, n) interface subroutine sub2(i) integer :: i(*) end subroutine sub2 end interface integer :: i(n) call sub2(i(3::2)) ! copy-out after the call will write to 'i' end subroutine sub subroutine test call sub((/1,2,3,4,5/), 5) end subroutine test ``` If we pass a reference to constant expression storage to 'sub' directly, the copy-out inside 'sub' will try to write into readonly memory. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D151271
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions