Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray_18.f90

raw
1 ! { dg-do compile }
2 ! { dg-options "-fcoarray=single" }
3 !
4 ! Prevent ICE when exceeding the maximal number of allowed
5 ! dimensions (normal + codimensions).
6 !
7 ! Fortran 2008 allows (co)arrays with 15 ranks
8 ! Previously gfortran only supported 7, cf. PR 37577
9 !
10 ! See also general coarray PR 18918
11 !
12 ! Test case taken from Leibniz-Rechenzentrum (LRZ)'s
13 ! fortran_tests with thanks to Reinhold Bader.
14 !
15
16 program ar
17 implicit none
18 integer :: ic(2)[*]
19 integer :: id(2,2)[2,*]
20 integer :: ie(2,2,2)[2,2,*]
21 ! Previously, these would give errors.
22 integer :: ig(2,2,2,2)[2,2,2,*]
23 integer :: ih(2,2,2,2,2)[2,2,2,2,*]
24 integer :: ij(2,2,2,2,2,2)[2,2,2,2,2,*]
25 integer :: ik(2,2,2,2,2,2,2)[2,2,2,2,2,2,*]
26 integer :: il[2,2,2,2,2,2,2,*]
27 integer :: im[2,2,2,2,2,2,2,2,*]
28 integer :: in[2,2,2,2,2,2,2,2,2,*]
29 integer :: io[2,2,2,2,2,2,2,2,2,2,*]
30 ! Now with max dimensions 15.....
31 integer :: ip(2,2,2,2,2,2,2,2)[2,2,2,2,2,2,2,*] ! { dg-error "has more than 15 dimensions" }
32 integer :: iq[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,*] ! { dg-error "has more than 15 dimensions" }
33 ! Check a non-coarray
34 integer :: ir(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2) ! { dg-error "has more than 15 dimensions" }
35 real :: x2(2,2,4)[2,*]
36 complex :: c2(4,2)[2,*]
37 double precision :: d2(1,5,9)[2,*]
38 character(len=1) :: ch2(2)[2,*]
39 character(len=2) :: ch22(-5:4)[2,*]
40 logical :: l2(17)[2,*]
41 if (this_image() == 1) then
42 write(*,*) 'OK'
43 end if
44 end program