54 lines · plain
1! RUN: bbc -emit-hlfir %s -o - | %python %S/gen_mod_ref_test.py | \2! RUN: fir-opt -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis-modref))' \3! RUN: --mlir-disable-threading -o /dev/null 2>&1 | FileCheck %s4 5! Test fir.call modref for dummy argument variables. This focus on6! the possibility of indirect effects inside the call.7 8module somemod9 interface10 subroutine may_capture(x)11 real, target :: x12 end subroutine13 subroutine set_pointer(x)14 real, pointer :: x15 end subroutine16 end interface17end module18 19subroutine test_dummy(test_var_x)20 use somemod, only : may_capture21 implicit none22 real :: test_var_x23 ! Capture is invalid after the call because test_var_xsaved does not have the24 ! target attribute.25 call may_capture(test_var_x)26 call test_effect_external()27end subroutine28! CHECK-LABEL: Testing : "_QPtest_dummy"29! CHECK: test_effect_external -> test_var_x#0: NoModRef30 31subroutine test_dummy_target(test_var_x_target)32 use somemod, only : may_capture33 implicit none34 real, target :: test_var_x_target35 call may_capture(test_var_x_target)36 call test_effect_external()37end subroutine38! CHECK-LABEL: Testing : "_QPtest_dummy_target"39! CHECK: test_effect_external -> test_var_x_target#0: ModRef40 41subroutine test_dummy_pointer(p)42 use somemod, only : set_pointer43 implicit none44 real, pointer :: p45 call set_pointer(p)46 ! Use associated to test the pointer target address, no the47 ! address of the pointer descriptor.48 associate(test_var_p_target => p)49 call test_effect_external()50 end associate51end subroutine52! CHECK-LABEL: Testing : "_QPtest_dummy_pointer"53! CHECK: test_effect_external -> test_var_p_target#0: ModRef54