llvm-project/flang/test/Integration/select-case-pointer-assign.f90
khaki3 9057744221
[flang] Fix SelectCaseOpConversion to convert block signatures (#175298)
When `fir.select_case` branches to blocks with arguments that have FIR
types (e.g., `!fir.ref`), the block signature must be converted to LLVM
types before creating the branch. Otherwise, the branch passes LLVM
types (`!llvm.ptr`) but the block expects FIR types, causing a type
mismatch error.

This adds block signature conversion similar to what
`SelectOpConversionBase` already does for `fir.select` and
`fir.select_rank`.
2026-01-12 09:45:15 -08:00

19 lines
381 B
Fortran

! RUN: %flang_fc1 -emit-llvm %s -o -
! Test that select case with pointer assignment compiles correctly.
! This requires block signature conversion in SelectCaseOpConversion.
subroutine test(l)
integer :: l
integer, pointer :: p(:)
integer, target :: a1(2), a2(2)
select case (l)
case (1)
p => a1
case (2)
p => a2
end select
p = 0
end subroutine