xref: /llvm-project/flang/test/Semantics/maxrank.f90 (revision 940871dd289c9f92ee32d899d58538c57c76c16d)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Enforce limits on rank + corank
3module m
4  !ERROR: 'x' has rank 16, which is greater than the maximum supported rank 15
5  real :: x(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
6  !ERROR: 'y' has rank 16, which is greater than the maximum supported rank 15
7  real, allocatable :: y(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:)
8  !ERROR: 'z' has rank 16, which is greater than the maximum supported rank 15
9  real, pointer :: z(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:)
10  !ERROR: 'w' has rank 16, which is greater than the maximum supported rank 15
11  real, dimension(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1) :: w
12  !ERROR: 'a' has rank 15 and corank 1, whose sum is greater than the maximum supported rank 15
13  real :: a(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)[*]
14  !ERROR: 'b' has rank 14 and corank 2, whose sum is greater than the maximum supported rank 15
15  real :: b(1,1,1,1,1,1,1,1,1,1,1,1,1,1)[1,*]
16  !ERROR: 'c' has rank 14 and corank 2, whose sum is greater than the maximum supported rank 15
17  real :: c
18  dimension :: c(1,1,1,1,1,1,1,1,1,1,1,1,1,1)
19  codimension :: c[1,*]
20  interface
21    !ERROR: 'foo' has rank 16, which is greater than the maximum supported rank 15
22    real function foo()
23      dimension :: foo(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
24    end function
25  end interface
26 contains
27  function bar() result(res)
28    !ERROR: 'res' has rank 16, which is greater than the maximum supported rank 15
29    real :: res(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
30  end function
31end module
32