| 1 | ! Array query and reduction intrinsics: SIZE, SUM, MAXVAL, MINVAL. |
| 2 | ! |
| 3 | ! CHECK: 4 |
| 4 | ! CHECK: 60 |
| 5 | ! CHECK: 50 |
| 6 | ! CHECK: -20 |
| 7 | program test_array_intrinsics |
| 8 | implicit none |
| 9 | integer, allocatable :: a(:) |
| 10 | |
| 11 | allocate(a(4)) |
| 12 | a(1) = 10 |
| 13 | a(2) = 20 |
| 14 | a(3) = 50 |
| 15 | a(4) = -20 |
| 16 | |
| 17 | print *, size(a) |
| 18 | print *, sum(a) |
| 19 | print *, maxval(a) |
| 20 | print *, minval(a) |
| 21 | |
| 22 | deallocate(a) |
| 23 | end program |
| 24 |