You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flang][semantics] add portability warning and tests for copy-in/copy-out case (#153263)
This PR adds some tests and a portability warning around
volatility/async, copy-in/copy-out, and definability. It was a NFC until
we decided to add the portability warning.
if (!dummyIsValue && (dummyIsAsynchronous || dummyIsVolatile)) {
774
+
if (actualIsAsynchronous || actualIsVolatile) {
775
+
if (actualCoarrayRef) { // F'2023 C1547
784
776
messages.Say(
785
-
"ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous ASYNCHRONOUS or VOLATILE %s"_err_en_US,
777
+
"Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with %s with ASYNCHRONOUS or VOLATILE attributes unless VALUE"_err_en_US,
786
778
dummyName);
787
779
}
780
+
if ((actualRank > 0 || actualIsAssumedRank) && !actualIsContiguous) {
"ASYNCHRONOUS or VOLATILE actual argument that is not simply contiguous may not be associated with a contiguous ASYNCHRONOUS or VOLATILE %s"_err_en_US,
786
+
dummyName);
787
+
}
788
+
}
789
+
// The vector subscript case is handled by the definability check above.
790
+
// The copy-in/copy-out cases are handled by the previous checks.
791
+
// Nag, GFortran, and NVFortran all error on this case, even though it is
!ERROR: Actual argument associated with VOLATILE dummy argument 'v=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
6
+
!BECAUSE: Variable 'v([INTEGER(8)::1_8,2_8,2_8,3_8,3_8,3_8,4_8,4_8,4_8,4_8])' has a vector subscript
7
+
call sub(v([1,2,2,3,3,3,4,4,4,4]))
8
+
!PORTABILITY: The array section 'v(21_8:30_8:1_8)' should not be associated with dummy argument 'v=' with VOLATILE attribute, unless the dummy is assumed-shape or assumed-rank [-Wportability]
9
+
call sub(v(21:30))
10
+
!PORTABILITY: The array section 'v(21_8:40_8:2_8)' should not be associated with dummy argument 'v=' with VOLATILE attribute, unless the dummy is assumed-shape or assumed-rank [-Wportability]
11
+
call sub(v(21:40:2))
12
+
call sub2(v(21:40:2))
13
+
call sub4(p)
14
+
print*, v
15
+
contains
16
+
subroutinesub(v)
17
+
integer, volatile :: v(10)
18
+
v =0
19
+
endsubroutine sub
20
+
subroutinesub1(v)
21
+
integer, volatile :: v(:)
22
+
v =0
23
+
endsubroutine sub1
24
+
subroutinesub2(v)
25
+
integer:: v(:)
26
+
!TODO: This should either be an portability warning or copy-in-copy-out warning
27
+
call sub(v)
28
+
call sub1(v)
29
+
endsubroutine sub2
30
+
subroutinesub3(v)
31
+
integer, pointer:: v(:)
32
+
v =0
33
+
endsubroutine sub3
34
+
subroutinesub4(v)
35
+
integer, pointer:: v(:)
36
+
!TODO: This should either be a portability warning or copy-in-copy-out warning
0 commit comments