You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split allocatable assignment to avoid deallocation before RHS evaluation
The previous allocatable assignment lowering was both allocating the new
storage and deallocating the old one/updating the allocatable before
generating a normal assignment in the new storage.
This is wrong in general because the previous allocatable value may be
used in the assignment RHS, so the deallocation/allocatable update must
be done after the assignment.
This patch split genReallocIfNeeded in two parts: the first part that
create a new storage if needed, to be called before lowering the
assignment, and a second part that creates the deallocation/allocatable
descriptor update after the assignment if a new storage was allocated.
This fixes runtime error for allocatable assignments like `a = a(1:100)`.
0 commit comments