diff options
author | Slava Zakharin <szakharin@nvidia.com> | 2023-06-06 16:12:49 -0700 |
---|---|---|
committer | Slava Zakharin <szakharin@nvidia.com> | 2023-06-06 20:25:07 -0700 |
commit | 6e4984a9d5f34f68f29779b07fff580639bd2f73 (patch) | |
tree | 3a02506183c5f27cc7fc1bfca4a18725c30598d4 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | a4bf2be5d2b585bd3d7baa70bd06cdfd6e0da4e0 (diff) | |
download | llvm-6e4984a9d5f34f68f29779b07fff580639bd2f73.zip llvm-6e4984a9d5f34f68f29779b07fff580639bd2f73.tar.gz llvm-6e4984a9d5f34f68f29779b07fff580639bd2f73.tar.bz2 |
[flang][hlfir] Enable assignments with allocatable components.
The TODO was left there to verify that Assign() runtime handles
overlaps of allocatable components. It did not, and this change-set
fixes it. Note that the same Assign() issue can be reproduced
without HLFIR. In the following example the LHS would be reallocated
before value of RHS (essentially, the same memory) is read:
```
program main
type t1
integer, allocatable :: a(:)
end type t1
type(t1) :: x, y
allocate(x%a(10))
do i =1,10
x%a(i) = 2*i
end do
x = x
print *, x%a
deallocate(x%a)
end program main
```
The test's output would be incorrect (though, this depends on the memory
reuse by malloc):
0 0 0 0 10 12 14 16 18 20
It is very hard to add a Flang unittest exploiting derived types.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D152306
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
0 files changed, 0 insertions, 0 deletions