-
Notifications
You must be signed in to change notification settings - Fork 13.3k
/
Copy pathmodref-call-dummies.f90
53 lines (48 loc) · 1.66 KB
/
modref-call-dummies.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
! RUN: bbc -emit-hlfir %s -o - | %python %S/gen_mod_ref_test.py | \
! RUN: fir-opt -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis-modref))' \
! RUN: --mlir-disable-threading -o /dev/null 2>&1 | FileCheck %s
! Test fir.call modref for dummy argument variables. This focus on
! the possibility of indirect effects inside the call.
module somemod
interface
subroutine may_capture(x)
real, target :: x
end subroutine
subroutine set_pointer(x)
real, pointer :: x
end subroutine
end interface
end module
subroutine test_dummy(test_var_x)
use somemod, only : may_capture
implicit none
real :: test_var_x
! Capture is invalid after the call because test_var_xsaved does not have the
! target attribute.
call may_capture(test_var_x)
call test_effect_external()
end subroutine
! CHECK-LABEL: Testing : "_QPtest_dummy"
! CHECK: test_effect_external -> test_var_x#0: NoModRef
subroutine test_dummy_target(test_var_x_target)
use somemod, only : may_capture
implicit none
real, target :: test_var_x_target
call may_capture(test_var_x_target)
call test_effect_external()
end subroutine
! CHECK-LABEL: Testing : "_QPtest_dummy_target"
! CHECK: test_effect_external -> test_var_x_target#0: ModRef
subroutine test_dummy_pointer(p)
use somemod, only : set_pointer
implicit none
real, pointer :: p
call set_pointer(p)
! Use associated to test the pointer target address, no the
! address of the pointer descriptor.
associate(test_var_p_target => p)
call test_effect_external()
end associate
end subroutine
! CHECK-LABEL: Testing : "_QPtest_dummy_pointer"
! CHECK: test_effect_external -> test_var_p_target#0: ModRef