[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / resolve88.f90
bloba0cb96bf0d6bff1edd95973646b3099f7a56968c
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! C746, C747, and C748
4 module m
5 use ISO_FORTRAN_ENV
6 use ISO_C_BINDING
8 ! C746 If a coarray-spec appears, it shall be a deferred-coshape-spec-list and
9 ! the component shall have the ALLOCATABLE attribute.
11 type testCoArrayType
12 real, allocatable, codimension[:] :: allocatableField
13 !ERROR: Component 'deferredfield' is a coarray and must have the ALLOCATABLE attribute
14 real, codimension[:] :: deferredField
15 !ERROR: Component 'pointerfield' is a coarray and must have the ALLOCATABLE attribute
16 !ERROR: 'pointerfield' may not have the POINTER attribute because it is a coarray
17 real, pointer, codimension[:] :: pointerField
18 !ERROR: Component 'realfield' is a coarray and must have the ALLOCATABLE attribute and have a deferred coshape
19 real, codimension[*] :: realField
20 !ERROR: 'realfield2' is an ALLOCATABLE coarray and must have a deferred coshape
21 real, allocatable, codimension[*] :: realField2
22 end type testCoArrayType
24 ! C747 If a coarray-spec appears, the component shall not be of type C_PTR or
25 ! C_FUNPTR from the intrinsic module ISO_C_BINDING (18.2), or of type
26 ! TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV (16.10.2).
28 type goodCoarrayType
29 real, allocatable, codimension[:] :: field
30 end type goodCoarrayType
32 type goodTeam_typeCoarrayType
33 type(team_type), allocatable :: field
34 end type goodTeam_typeCoarrayType
36 type goodC_ptrCoarrayType
37 type(c_ptr), allocatable :: field
38 end type goodC_ptrCoarrayType
40 type goodC_funptrCoarrayType
41 type(c_funptr), allocatable :: field
42 end type goodC_funptrCoarrayType
44 type team_typeCoarrayType
45 !ERROR: A coarray component may not be of type TEAM_TYPE from ISO_FORTRAN_ENV
46 type(team_type), allocatable, codimension[:] :: field
47 end type team_typeCoarrayType
49 type c_ptrCoarrayType
50 !ERROR: A coarray component may not be of type C_PTR or C_FUNPTR from ISO_C_BINDING
51 type(c_ptr), allocatable, codimension[:] :: field
52 end type c_ptrCoarrayType
54 type c_funptrCoarrayType
55 !ERROR: A coarray component may not be of type C_PTR or C_FUNPTR from ISO_C_BINDING
56 type(c_funptr), allocatable, codimension[:] :: field
57 end type c_funptrCoarrayType
59 ! C748 A data component whose type has a coarray ultimate component shall be a
60 ! nonpointer nonallocatable scalar and shall not be a coarray.
62 type coarrayType
63 real, allocatable, codimension[:] :: goodCoarrayField
64 end type coarrayType
66 type testType
67 type(coarrayType) :: goodField
68 !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
69 type(coarrayType), pointer :: pointerField
70 !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
71 type(coarrayType), allocatable :: allocatableField
72 !ERROR: An array or coarray component may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
73 type(coarrayType), dimension(3) :: arrayField
74 end type testType
76 end module m