1! RUN: %S/test_errors.sh %s %t %flang_fc1 2! REQUIRES: shell 3subroutine s1 4 !ERROR: Array 'z' without ALLOCATABLE or POINTER attribute must have explicit shape 5 common x, y(4), z(:) 6end 7 8subroutine s2 9 common /c1/ x, y, z 10 !ERROR: 'y' is already in a COMMON block 11 common y 12end 13 14subroutine s3 15 !ERROR: 'x' may not be a procedure as it is in a COMMON block 16 procedure(real) :: x 17 common x 18 common y 19 !ERROR: 'y' may not be a procedure as it is in a COMMON block 20 procedure(real) :: y 21end 22 23subroutine s5 24 integer x(2) 25 !ERROR: The dimensions of 'x' have already been declared 26 common x(4), y(4) 27 !ERROR: The dimensions of 'y' have already been declared 28 real y(2) 29end 30 31function f6(x) result(r) 32 !ERROR: Dummy argument 'x' may not appear in a COMMON block 33 !ERROR: ALLOCATABLE object 'y' may not appear in a COMMON block 34 common x,y,z 35 allocatable y 36 !ERROR: Function result 'r' may not appear in a COMMON block 37 common r 38end 39 40module m7 41 !ERROR: Variable 'w' with BIND attribute may not appear in a COMMON block 42 !ERROR: Variable 'z' with BIND attribute may not appear in a COMMON block 43 common w,z 44 integer, bind(c) :: z 45 integer, bind(c,name="w") :: w 46end 47 48module m8 49 type t 50 end type 51 class(*), pointer :: x 52 !ERROR: Unlimited polymorphic pointer 'x' may not appear in a COMMON block 53 !ERROR: Unlimited polymorphic pointer 'y' may not appear in a COMMON block 54 common x, y 55 class(*), pointer :: y 56end 57 58module m9 59 integer x 60end 61subroutine s9 62 use m9 63 !ERROR: 'x' is use-associated from module 'm9' and cannot be re-declared 64 common x 65end 66 67module m10 68 type t 69 end type 70 type(t) :: x 71 !ERROR: Derived type 'x' in COMMON block must have the BIND or SEQUENCE attribute 72 common x 73end 74 75module m11 76 type t1 77 sequence 78 integer, allocatable :: a 79 end type 80 type t2 81 sequence 82 type(t1) :: b 83 integer:: c 84 end type 85 type(t2) :: x2 86 !ERROR: Derived type variable 'x2' may not appear in a COMMON block due to ALLOCATABLE component 87 common x2 88end 89 90module m12 91 type t1 92 sequence 93 integer :: a = 123 94 end type 95 type t2 96 sequence 97 type(t1) :: b 98 integer:: c 99 end type 100 type(t2) :: x2 101 !ERROR: Derived type variable 'x2' may not appear in a COMMON block due to component with default initialization 102 common x2 103end 104 105subroutine s13 106 block 107 !ERROR: COMMON statement is not allowed in a BLOCK construct 108 common x 109 end block 110end 111 112subroutine s14 113 !ERROR: 'c' appears as a COMMON block in a BIND statement but not in a COMMON statement 114 bind(c) :: /c/ 115end 116