AMDGPU: Allow f16/bf16 for DS_READ_TR16_B64 gfx950 builtins (#118297)
[llvm-project.git] / flang / test / Semantics / resolve88.f90
blob3794e9b28a6d3bc565ac79228a91f2caec986a9c
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C746, C747, and C748
3 module m
4 use ISO_FORTRAN_ENV
5 use ISO_C_BINDING
7 ! C746 If a coarray-spec appears, it shall be a deferred-coshape-spec-list and
8 ! the component shall have the ALLOCATABLE attribute.
10 type testCoArrayType
11 real, allocatable, codimension[:] :: allocatableField
12 !ERROR: Component 'deferredfield' is a coarray and must have the ALLOCATABLE attribute
13 real, codimension[:] :: deferredField
14 !ERROR: Component 'pointerfield' is a coarray and must have the ALLOCATABLE attribute
15 !ERROR: 'pointerfield' may not have the POINTER attribute because it is a coarray
16 real, pointer, codimension[:] :: pointerField
17 !ERROR: Component 'realfield' is a coarray and must have the ALLOCATABLE attribute and have a deferred coshape
18 real, codimension[*] :: realField
19 !ERROR: 'realfield2' is an ALLOCATABLE coarray and must have a deferred coshape
20 real, allocatable, codimension[*] :: realField2
21 end type testCoArrayType
23 ! C747 If a coarray-spec appears, the component shall not be of type C_PTR or
24 ! C_FUNPTR from the intrinsic module ISO_C_BINDING (18.2), or of type
25 ! TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV (16.10.2).
27 type goodCoarrayType
28 real, allocatable, codimension[:] :: field
29 end type goodCoarrayType
31 type goodTeam_typeCoarrayType
32 type(team_type), allocatable :: field
33 end type goodTeam_typeCoarrayType
35 type goodC_ptrCoarrayType
36 type(c_ptr), allocatable :: field
37 end type goodC_ptrCoarrayType
39 type goodC_funptrCoarrayType
40 type(c_funptr), allocatable :: field
41 end type goodC_funptrCoarrayType
43 type team_typeCoarrayType
44 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR
45 type(team_type), allocatable, codimension[:] :: field
46 end type team_typeCoarrayType
48 type c_ptrCoarrayType
49 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR
50 type(c_ptr), allocatable, codimension[:] :: field
51 end type c_ptrCoarrayType
53 type c_funptrCoarrayType
54 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR
55 type(c_funptr), allocatable, codimension[:] :: field
56 end type c_funptrCoarrayType
58 ! C748 A data component whose type has a coarray ultimate component shall be a
59 ! nonpointer nonallocatable scalar and shall not be a coarray.
61 type coarrayType
62 real, allocatable, codimension[:] :: goodCoarrayField
63 end type coarrayType
65 type testType
66 type(coarrayType) :: goodField
67 !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
68 type(coarrayType), pointer :: pointerField
69 !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
70 type(coarrayType), allocatable :: allocatableField
71 !ERROR: An array or coarray component may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
72 type(coarrayType), dimension(3) :: arrayField
73 end type testType
75 end module m