llvm-project/flang/test/Lower/call-suspect.f90
jeanPerier e6618aae43
[flang] fix ignore_tkr(tk) with character dummy (#108168)
The test code with ignore_tkr(tk) on character dummy passed by
fir.boxchar<> was crashing the compiler in [an
assert](2afe678f0a/flang/lib/Optimizer/Dialect/FIRType.cpp (L632))
in `changeElementType`.

It makes little sense to call changeElementType on a fir.boxchar since
this type is lossy (the shape is not part of it). Just skip it in the
code dealing with ignore(tk) when hitting this case
2024-09-16 16:27:11 +02:00

29 lines
813 B
Fortran

! Note: flang will issue warnings for the following subroutines. These
! are accepted regardless to maintain backwards compatibility with
! other Fortran implementations.
! RUN: bbc -emit-fir %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPs1() {
! CHECK: fir.convert %{{.*}} : ((!fir.boxchar<1>) -> ()) -> ((!fir.ref<f32>) -> ())
! Pass a REAL by reference to a subroutine expecting a CHARACTER
subroutine s1
call s3(r)
end subroutine s1
! CHECK-LABEL: func @_QPs2(
! CHECK: fir.convert %{{.*}} : ((!fir.boxchar<1>) -> ()) -> ((!fir.ref<f32>) -> ())
! Pass a REAL, POINTER data reference to a subroutine expecting a CHARACTER
subroutine s2(p)
real, pointer :: p
call s3(p)
end subroutine s2
! CHECK-LABEL: func @_QPs3(
! CHECK-SAME: !fir.boxchar<1>
subroutine s3(c)
character(8) c
end subroutine s3