File: change_team01.f90

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (70 lines) | stat: -rw-r--r-- 2,259 bytes parent folder | download | duplicates (12)
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
! RUN: %python %S/test_errors.py %s %flang_fc1
! Check for semantic errors in change team statements.
! Only those semantics which differ from those of FORM TEAM statements are checked.

subroutine test
  use, intrinsic :: iso_fortran_env, only: team_type
  type(team_type) :: team
  integer, codimension[*] :: selector
  integer, codimension[2,*] :: selector2d

  ! Valid invocations which should produce no errors.
  block
  change team (team)
  end team
  construct1: change team (team)
  end team construct1
  change team (team, ca[*] => selector)
  end team
  change team (team, ca[2,*] => selector)
  end team
  change team (team, ca[*] => selector)
  end team
  change team (team, ca[*] => selector, ca2[2,*] => selector2d)
  end team
  end block

  !A selector may appear only once in selector-list.
  ! ERROR: Selector 'selector' was already used as a selector or coarray in this statement
  change team (team, ca[*] => selector, ca2[*] => selector)
  end team

  ! Within a CHANGE TEAM construct, a CYCLE or EXIT statement is not allowed if it belongs to an outer construct.
  block
  outer1: if (.true.) then
    change team (team)
      if (.true.) then
        ! ERROR: EXIT must not leave a CHANGE TEAM statement
        exit outer1
      end if
    end team
  end if outer1
  end block
  block
  outer2: do
    change team (team)
      ! ERROR: CYCLE must not leave a CHANGE TEAM statement
      cycle outer2
    end team
  end do outer2
  end block

  ! The construct name must not be the same as any other construct name in the scoping unit.
  block
  construct2: block
  end block construct2
  ! ERROR: 'construct2' is already declared in this scoping unit
  construct2: change team (team)
  end team construct2
  end block

  ! When the CHANGE TEAM statement is executed, the selectors must all be established coarrays.
  ! ERROR: Selector in coarray association must name a coarray
  change team (team, ca[*] => not_selector)
  end team

  ! The coarray name in a coarray-association must not be the same as the name as the name of another coarray or of a selector in the CHANGE TEAM statement.
  ! ERROR: 'selector' is not an object that can appear in an expression
  change team (team, selector[*] => selector)
  end team
end subroutine