-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
3 changed files
with
77 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters