brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · f3f8409 Raw
148 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Construct names3 4subroutine s15  real :: foo6  !ERROR: 'foo' is already declared in this scoping unit7  foo: block8  end block foo9end10 11subroutine s2(x)12  logical :: x13  foo: if (x) then14  end if foo15  !ERROR: 'foo' is already declared in this scoping unit16  foo: do i = 1, 1017  end do foo18end19 20subroutine s321  real :: a(10,10), b(10,10)22  type y; end type23  integer(8) :: x24  !PORTABILITY: Index variable 'y' should be a scalar object or common block if it is present in the enclosing scope [-Wodd-index-variable-restrictions]25  !ERROR: Must have INTEGER type, but is REAL(4)26  forall(x=1:10, y=1:10)27    !ERROR: Must have INTEGER type, but is REAL(4)28    !ERROR: Must have INTEGER type, but is REAL(4)29    a(x, y) = b(x, y)30  end forall31  !PORTABILITY: Index variable 'y' should be a scalar object or common block if it is present in the enclosing scope [-Wodd-index-variable-restrictions]32  !ERROR: Must have INTEGER type, but is REAL(4)33  !ERROR: Must have INTEGER type, but is REAL(4)34  !ERROR: Must have INTEGER type, but is REAL(4)35  forall(x=1:10, y=1:10) a(x, y) = b(x, y)36end37 38subroutine s439  real :: a(10), b(10)40  complex :: x41  integer :: i(2)42  !ERROR: Must have INTEGER type, but is COMPLEX(4)43  forall(x=1:10)44    !ERROR: Must have INTEGER type, but is COMPLEX(4)45    !ERROR: Must have INTEGER type, but is COMPLEX(4)46    a(x) = b(x)47  end forall48  !ERROR: Must have INTEGER type, but is REAL(4)49  forall(y=1:10)50    !ERROR: Must have INTEGER type, but is REAL(4)51    !ERROR: Must have INTEGER type, but is REAL(4)52    a(y) = b(y)53  end forall54  !PORTABILITY: Index variable 'i' should be scalar in the enclosing scope [-Wodd-index-variable-restrictions]55  forall(i=1:10)56    a(i) = b(i)57  end forall58end59 60subroutine s661  integer, parameter :: n = 462  real, dimension(n) :: x63  data(x(i), i=1, n) / n * 0.0 /64  !PORTABILITY: Index variable 't' should be a scalar object or common block if it is present in the enclosing scope [-Wodd-index-variable-restrictions]65  !ERROR: Must have INTEGER type, but is REAL(4)66  !ERROR: Must have INTEGER type, but is REAL(4)67  forall(t=1:n) x(t) = 0.068contains69  subroutine t70  end71end72 73subroutine s6b74  integer, parameter :: k = 475  integer :: l = 476  forall(integer(k) :: i = 1:10)77  end forall78  ! C713 A scalar-int-constant-name shall be a named constant of type integer.79  !ERROR: Must be a constant value80  forall(integer(l) :: i = 1:10)81  end forall82end83 84subroutine s785  !ERROR: 'i' is already declared in this scoping unit86  do concurrent(integer::i=1:5) local(j, i) &87      !ERROR: 'j' is already declared in this scoping unit88      local_init(k, j) &89      !WARNING: Variable 'a' with SHARED locality implicitly declared [-Wimplicit-shared]90      shared(a)91    a = j + 192  end do93end94 95subroutine s896  implicit none97  !ERROR: No explicit type declared for 'i'98  do concurrent(i=1:5) &99    !ERROR: No explicit type declared for 'j'100    local(j) &101    !ERROR: No explicit type declared for 'k'102    local_init(k)103  end do104end105 106subroutine s9107  integer :: j108  !ERROR: 'i' is already declared in this scoping unit109  do concurrent(integer::i=1:5) shared(i) &110      shared(j) &111      !ERROR: 'j' is already declared in this scoping unit112      shared(j)113  end do114end115 116subroutine s10117  external bad1118  real, parameter :: bad2 = 1.0119  x = cos(0.)120  do concurrent(i=1:2) &121    !ERROR: 'bad1' may not appear in a locality-spec because it is not definable122    !BECAUSE: 'bad1' is not a variable123    local(bad1) &124    !ERROR: 'bad2' may not appear in a locality-spec because it is not definable125    !BECAUSE: 'bad2' is not a variable126    local(bad2) &127    !ERROR: 'bad3' may not appear in a locality-spec because it is not definable128    !BECAUSE: 'bad3' is not a variable129    local(bad3) &130    !ERROR: 'cos' may not appear in a locality-spec because it is not definable131    !BECAUSE: 'cos' is not a variable132    local(cos)133  end do134  do concurrent(i=1:2) &135    !ERROR: The name 'bad1' must be a variable to appear in a locality-spec136    shared(bad1) &137    !ERROR: The name 'bad2' must be a variable to appear in a locality-spec138    shared(bad2) &139    !ERROR: The name 'bad3' must be a variable to appear in a locality-spec140    shared(bad3) &141    !ERROR: The name 'cos' must be a variable to appear in a locality-spec142    shared(cos)143  end do144contains145  subroutine bad3146  end147end148