File: collectives02.f90

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-20
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,436 kB
  • sloc: cpp: 5,593,990; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (104 lines) | stat: -rw-r--r-- 3,640 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
! RUN: %python %S/test_errors.py %s %flang_fc1
! XFAIL: *
! This test checks for semantic errors in co_min subroutine calls based on
! the co_min interface defined in section 16.9.48 of the Fortran 2018 standard.
! To Do: add co_min to the list of intrinsics

program test_co_min
  implicit none

  integer          i, integer_array(1), coindexed_integer[*], status
  character(len=1) c, character_array(1), coindexed_character[*], message
  double precision d, double_precision_array(1)
  real             r, real_array(1), coindexed_real[*]
  complex          complex_type
  logical          bool
  
  !___ standard-conforming calls with no keyword arguments ___
  call co_min(i)
  call co_min(c)
  call co_min(d)
  call co_min(r)
  call co_min(i, 1)
  call co_min(c, 1, status)
  call co_min(d, 1, status, message)
  call co_min(r, 1, status, message)
  call co_min(integer_array)
  call co_min(character_array, 1)
  call co_min(double_precision_array, 1, status)
  call co_min(real_array, 1, status, message)

  !___ standard-conforming calls with keyword arguments ___

  ! all arguments present
  call co_min(a=i, result_image=1, stat=status, errmsg=message) 
  call co_min(result_image=1, a=i, errmsg=message, stat=status) 

  ! one optional argument not present
  call co_min(a=i,                 stat=status, errmsg=message) 
  call co_min(a=i, result_image=1,              errmsg=message)
  call co_min(a=i, result_image=1, stat=status                )

  ! two optional arguments not present
  call co_min(a=i, result_image=1                             ) 
  call co_min(a=i,                 stat=status                )
  call co_min(a=i,                              errmsg=message) 

  ! no optional arguments present
  call co_min(a=i) 

  !___ non-standard-conforming calls ___

  ! argument 'a' shall be of numeric type
  !ERROR: Actual argument for 'a=' has bad type 'LOGICAL(4)'
  call co_min(bool)
  
  ! argument 'a' shall be of numeric type
  !ERROR: Actual argument for 'a=' has bad type 'COMPLEX(4)'
  call co_min(complex_type)
  
  ! argument 'a' is intent(inout)
  !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'a=' must be definable
  call co_min(a=1+1)
  
  ! argument 'a' shall not be a coindexed object
  !ERROR: to be determined
  call co_min(a=coindexed_real[1])
  
  ! 'result_image' argument shall be a scalar
  !ERROR: too many actual arguments for intrinsic 'co_min'
  call co_min(i, result_image=bool)
  
  ! 'result_image' argument shall be an integer scalar
  !ERROR: too many actual arguments for intrinsic 'co_min'
  call co_min(c, result_image=integer_array)
  
  ! 'stat' argument shall be noncoindexed
  !ERROR: to be determined
  call co_min(d, stat=coindexed_integer[1])
 
  ! 'stat' argument shall be an integer
  !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)'
  call co_min(r, stat=message)
 
  ! 'stat' argument shall be an integer scalar
  !ERROR: 'stat=' argument has unacceptable rank 1
  call co_min(i, stat=integer_array)
 
  ! 'errmsg' argument shall be noncoindexed
  !ERROR: to be determined
  call co_min(c, errmsg=coindexed_character[1])
 
  ! 'errmsg' argument shall be character scalar
  !ERROR: 'errmsg=' argument has unacceptable rank 1
  call co_min(d, errmsg=character_array)
 
  ! the error is seen as too many arguments to the co_min() call
  !ERROR: too many actual arguments for intrinsic 'co_min'
  call co_min(r, result_image=1, stat=status, errmsg=message, 3.4)
  
  ! keyword argument with incorrect name
  !ERROR: unknown keyword argument to intrinsic 'co_min'
  call co_min(fake=3.4)
  
end program test_co_min