@@ -9,6 +9,9 @@ module m1
99 sequence
1010 real :: t2Field
1111 end type
12+ type t3
13+ type (t2) :: t3Field
14+ end type
1215contains
1316
1417 ! C852
@@ -80,6 +83,7 @@ subroutine s5
8083 real , pointer , volatile :: q
8184 p = > x
8285 ! ERROR: Pointer must be VOLATILE when target is a VOLATILE coarray
86+ ! ERROR: VOLATILE target associated with non-VOLATILE pointer
8387 p = > y
8488 ! ERROR: Pointer may not be VOLATILE when target is a non-VOLATILE coarray
8589 q = > x
@@ -165,6 +169,36 @@ subroutine s11
165169 ca[1 ]% p = > x
166170 end
167171
172+ subroutine s12
173+ real , volatile, target :: x
174+ real , pointer :: p
175+ real , pointer , volatile :: q
176+ ! ERROR: VOLATILE target associated with non-VOLATILE pointer
177+ p = > x
178+ q = > x
179+ end
180+
181+ subroutine s13
182+ type (t3), target , volatile :: y = t3(t2(4.4 ))
183+ real , pointer :: p1
184+ type (t2), pointer :: p2
185+ type (t3), pointer :: p3
186+ real , pointer , volatile :: q1
187+ type (t2), pointer , volatile :: q2
188+ type (t3), pointer , volatile :: q3
189+ ! ERROR: VOLATILE target associated with non-VOLATILE pointer
190+ p1 = > y% t3Field% t2Field
191+ ! ERROR: VOLATILE target associated with non-VOLATILE pointer
192+ p2 = > y% t3Field
193+ ! ERROR: VOLATILE target associated with non-VOLATILE pointer
194+ p3 = > y
195+ ! OK:
196+ q1 = > y% t3Field% t2Field
197+ ! OK:
198+ q2 = > y% t3Field
199+ ! OK:
200+ q3 = > y
201+ end
168202end
169203
170204module m2
0 commit comments