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`.
19 lines
381 B
Fortran
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
|