|
3 | 3 | program test_size |
4 | 4 | real :: scalar |
5 | 5 | real, dimension(5, 5) :: array |
6 | | - call test(array, array) |
| 6 | + call test(array, array, array) |
7 | 7 | contains |
8 | | - subroutine test(arg, assumedRank) |
| 8 | + subroutine test(arg, assumedRank, poly) |
9 | 9 | real, dimension(5, *) :: arg |
10 | 10 | real, dimension(..) :: assumedRank |
| 11 | + class(*) :: poly(5, *) |
11 | 12 | !ERROR: A dim= argument is required for 'size' when the array is assumed-size |
12 | 13 | print *, size(arg) |
| 14 | + print *, size(arg, dim=1) ! ok |
| 15 | + select type (poly) |
| 16 | + type is (real) |
| 17 | + !ERROR: A dim= argument is required for 'size' when the array is assumed-size |
| 18 | + print *, size(poly) |
| 19 | + print *, size(poly, dim=1) ! ok |
| 20 | + end select |
13 | 21 | !ERROR: A dim= argument is required for 'ubound' when the array is assumed-size |
14 | 22 | print *, ubound(arg) |
| 23 | + print *, ubound(arg, dim=1) ! ok |
| 24 | + select type (poly) |
| 25 | + type is (real) |
| 26 | + !ERROR: A dim= argument is required for 'ubound' when the array is assumed-size |
| 27 | + print *, ubound(poly) |
| 28 | + print *, ubound(poly, dim=1) ! ok |
| 29 | + end select |
15 | 30 | !ERROR: The 'source=' argument to the intrinsic function 'shape' may not be assumed-size |
16 | 31 | print *, shape(arg) |
| 32 | + select type (poly) |
| 33 | + type is (real) |
| 34 | + !ERROR: The 'source=' argument to the intrinsic function 'shape' may not be assumed-size |
| 35 | + print *, shape(poly) |
| 36 | + end select |
17 | 37 | !ERROR: The 'harvest=' argument to the intrinsic procedure 'random_number' may not be assumed-size |
18 | 38 | call random_number(arg) |
19 | 39 | !ERROR: 'array=' argument has unacceptable rank 0 |
@@ -85,5 +105,16 @@ subroutine test(arg, assumedRank) |
85 | 105 | print *, lbound(assumedRank, dim=2) |
86 | 106 | print *, ubound(assumedRank, dim=2) |
87 | 107 | end select |
| 108 | + contains |
| 109 | + subroutine inner |
| 110 | + !ERROR: A dim= argument is required for 'size' when the array is assumed-size |
| 111 | + print *, size(arg) |
| 112 | + print *, size(arg, dim=1) ! ok |
| 113 | + !ERROR: A dim= argument is required for 'ubound' when the array is assumed-size |
| 114 | + print *, ubound(arg) |
| 115 | + print *, ubound(arg, dim=1) ! ok |
| 116 | + !ERROR: The 'source=' argument to the intrinsic function 'shape' may not be assumed-size |
| 117 | + print *, shape(arg) |
| 118 | + end |
88 | 119 | end subroutine |
89 | 120 | end |
0 commit comments