Files
clang-p2996/flang/test/Lower/implicit-interface.f90
Tom Eccles 4cc9437a7e [flang] Set default to -ffpcontract=fast
Following RFC at
https://discourse.llvm.org/t/rfc-ffp-contract-default-value/66301

This adds the `fastmath<contract>` attribute to `fir.call` and some
floating point arithmetic operations (hence the many test changes).
Instead of testing for this specific attribute, I am using a regular
expression to match any attributes.
2022-11-17 15:49:51 +00:00

30 lines
1.3 KiB
Fortran

! RUN: bbc -emit-fir %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPchar_return_callee(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.char<1,10>>{{.*}}, %{{.*}}: index{{.*}}, %{{.*}}: !fir.ref<i32>{{.*}}) -> !fir.boxchar<1> {
function char_return_callee(i)
character(10) :: char_return_callee
integer :: i
end function
! CHECK-LABEL: @_QPtest_char_return_caller()
subroutine test_char_return_caller
character(10) :: char_return_caller
! CHECK: fir.call @_QPchar_return_caller({{.*}}) {{.*}}: (!fir.ref<!fir.char<1,10>>, index, !fir.ref<i32>) -> !fir.boxchar<1>
print *, char_return_caller(5)
end subroutine
! CHECK-LABEL: func @_QPtest_passing_char_array()
subroutine test_passing_char_array
character(len=3) :: x(4)
call sub_taking_a_char_array(x)
! CHECK-DAG: %[[xarray:.*]] = fir.alloca !fir.array<4x!fir.char<1,3>>
! CHECK-DAG: %[[c3:.*]] = arith.constant 3 : index
! CHECK-DAG: %[[xbuff:.*]] = fir.convert %[[xarray]] : (!fir.ref<!fir.array<4x!fir.char<1,3>>>) -> !fir.ref<!fir.char<1,?>>
! CHECK: %[[boxchar:.*]] = fir.emboxchar %[[xbuff]], %[[c3]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
! CHECK: fir.call @_QPsub_taking_a_char_array(%[[boxchar]]) {{.*}}: (!fir.boxchar<1>) -> ()
end subroutine
! TODO more implicit interface cases with/without explicit interface