File: coarray_4.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (88 lines) | stat: -rw-r--r-- 2,778 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! Coarray support -- corank declarations
! PR fortran/18918
!

subroutine valid(n, c, f)
  implicit none
  integer :: n
  integer, save :: a[*], b(4)[-1:4,*]
  real :: c(*)[1,0:3,3:*]
  real :: f(n)[0:n,-100:*]
  integer, allocatable :: d[:], e(:)[:,:]
  integer, save, codimension[1,*] :: g, h(7), i(6)[*], j[*]
  integer :: k
  codimension :: k[*]
  save :: k
  integer :: ii = 7
  block
    integer :: j = 5
    integer, save :: kk[j, *] ! { dg-error "Variable .j. cannot appear in the expression" }
  end block
end subroutine valid

subroutine valid2()
  type t
    integer, allocatable :: a[:]
  end type t
  type, extends(t) :: tt
    integer, allocatable :: b[:]
  end type tt
  type(tt), save :: foo
  type(tt) :: bar
end subroutine valid2

subroutine invalid(n)
  implicit none
  integer :: n
  integer :: k[*] ! { dg-error "not ALLOCATABLE, SAVE nor a dummy" }
  integer :: h(3)[*] ! { dg-error "not ALLOCATABLE, SAVE nor a dummy" }
  integer, save :: a[*]
  codimension :: a[1,*] ! { dg-error "Duplicate CODIMENSION attribute" }
  complex, save :: hh(n)[*] ! { dg-error "cannot have the SAVE attribute" }
  integer :: j = 6

  integer, save :: hf1[j,*] ! { dg-error "cannot appear in the expression" }
  integer, save :: hf2[n,*] ! OK
  integer, save :: hf3(4)[j,*] ! { dg-error "cannot appear in the expression|cannot have the SAVE attribute" }
  integer, save :: hf4(5)[n,*] ! OK

  integer, allocatable :: a2[*] ! { dg-error "must have deferred shape" }
  integer, allocatable :: a3(:)[*] ! { dg-error "must have deferred shape" }
  integer, allocatable :: a4[*] ! { dg-error "must have deferred shape" }
end subroutine invalid

subroutine invalid2
  use iso_c_binding
  implicit none
  type t0
    integer, allocatable :: a[:,:,:]
  end type t0
  type t
  end type t
  type, extends(t) :: tt ! { dg-error "has a coarray component, parent type" }
    integer, allocatable :: a[:]
  end type tt
  type ttt
    integer, pointer :: a[:] ! { dg-error "must be allocatable" }
  end type ttt
  type t4
    integer, allocatable :: b[4,*] ! { dg-error "with deferred shape" }
  end type t4
  type t5
    type(c_ptr), allocatable :: p[:] ! { dg-error "shall not be a coarray" }
  end type t5
  type(t0), save :: t0_1[*] ! { dg-error "shall be a nonpointer, nonallocatable scalar" }
  type(t0), allocatable :: t0_2[:] ! { dg-error "shall be a nonpointer, nonallocatable scalar" }
  type(c_ptr), save :: pp[*] ! { dg-error "shall not be a coarray" }
end subroutine invalid2

elemental subroutine elem(a) ! { dg-error "Coarray dummy argument" }
  integer, intent(in) :: a[*]
end subroutine

function func() result(res)
  integer :: res[*] ! { dg-error "CODIMENSION attribute conflicts with RESULT" }
end function func