-
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] Do not instantiate components in initial targets as objects (#…
…75778) Lowering was instantiating component symbols (but the last) in initial target designator as if they were whole objects, leading to collisions and bugs. Fixes #75728
- Loading branch information
1 parent
3068d27
commit 41096d1
Showing
2 changed files
with
21 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
! Test https://github.com/llvm/llvm-project/issues/75728 fix. | ||
! RUN: bbc -emit-hlfir -o - -I nw %s | FileCheck %s | ||
|
||
subroutine test() | ||
type t | ||
complex :: z | ||
end type | ||
type(t), target, save :: obj | ||
real, pointer :: p => obj%z%re | ||
end subroutine | ||
! CHECK-LABEL: fir.global internal @_QFtestEp : !fir.box<!fir.ptr<f32>> { | ||
! CHECK-NEXT: %[[VAL_0:.*]] = fir.address_of(@_QFtestEobj) : !fir.ref<!fir.type<_QFtestTt{z:!fir.complex<4>}>> | ||
! CHECK-NEXT: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtestEobj"} : (!fir.ref<!fir.type<_QFtestTt{z:!fir.complex<4>}>>) -> (!fir.ref<!fir.type<_QFtestTt{z:!fir.complex<4>}>>, !fir.ref<!fir.type<_QFtestTt{z:!fir.complex<4>}>>) | ||
! CHECK-NEXT: %[[VAL_2:.*]] = hlfir.designate %[[VAL_1]]#0{"z"} real : (!fir.ref<!fir.type<_QFtestTt{z:!fir.complex<4>}>>) -> !fir.ref<f32> | ||
! CHECK-NEXT: %[[VAL_3:.*]] = fir.embox %[[VAL_2]] : (!fir.ref<f32>) -> !fir.box<f32> | ||
! CHECK-NEXT: %[[VAL_4:.*]] = fir.rebox %[[VAL_3]] : (!fir.box<f32>) -> !fir.box<!fir.ptr<f32>> | ||
! CHECK-NEXT: fir.has_value %[[VAL_4]] : !fir.box<!fir.ptr<f32>> |