1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
2 ! This test is responsible for checking the fix for passing non-variables as
3 ! actual arguments to subroutines/functions whose corresponding dummy argument
4 ! expects a VOLATILE variable
5 ! c.f. llvm-project GitHub issue #58973
9 subroutine vol_dum_int(my_int
)
10 integer, volatile :: my_int
11 end subroutine vol_dum_int
13 subroutine vol_dum_real(my_real
)
14 real, volatile :: my_real
15 end subroutine vol_dum_real
17 subroutine vol_dum_complex(my_complex
)
18 complex, volatile :: my_complex
19 end subroutine vol_dum_complex
21 subroutine vol_dum_int_arr(my_int_arr
)
22 integer, dimension(2,2), volatile :: my_int_arr
23 end subroutine vol_dum_int_arr
25 subroutine test_all_subprograms()
26 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int=' is not a variable
28 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int=' is not a variable
29 call vol_dum_int(6+12)
30 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int=' is not a variable
31 call vol_dum_int(6*12)
32 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int=' is not a variable
33 call vol_dum_int(-6/2)
35 !WARNING: actual argument associated with VOLATILE dummy argument 'my_real=' is not a variable
36 call vol_dum_real(3.141592653)
37 !WARNING: actual argument associated with VOLATILE dummy argument 'my_real=' is not a variable
38 call vol_dum_real(3.141592653 + -10.6e-11)
39 !WARNING: actual argument associated with VOLATILE dummy argument 'my_real=' is not a variable
40 call vol_dum_real(3.141592653 * 10.6e-11)
41 !WARNING: actual argument associated with VOLATILE dummy argument 'my_real=' is not a variable
42 call vol_dum_real(3.141592653 / -10.6e-11)
44 !WARNING: actual argument associated with VOLATILE dummy argument 'my_complex=' is not a variable
45 call vol_dum_complex((1., 3.2))
46 !WARNING: actual argument associated with VOLATILE dummy argument 'my_complex=' is not a variable
47 call vol_dum_complex((1., 3.2) + (-2., 3.14))
48 !WARNING: actual argument associated with VOLATILE dummy argument 'my_complex=' is not a variable
49 call vol_dum_complex((1., 3.2) * (-2., 3.14))
50 !WARNING: actual argument associated with VOLATILE dummy argument 'my_complex=' is not a variable
51 call vol_dum_complex((1., 3.2) / (-2., 3.14))
53 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not a variable
54 call vol_dum_int_arr((/ 1, 2, 3, 4 /))
55 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not a variable
56 call vol_dum_int_arr(reshape((/ 1, 2, 3, 4 /), (/ 2, 2/)))
57 !WARNING: actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not a variable
58 call vol_dum_int_arr((/ 1, 2, 3, 4 /))
59 end subroutine test_all_subprograms