2 ! { dg-options "-std=f2008 -fall-intrinsics" }
4 ! Test for correct semantics of implied-shape arrays.
6 ! Contributed by Daniel Kraft, d@domob.eu.
11 INTEGER, PARAMETER :: n = 3
13 ! Should be able to reduce complex expressions.
14 REAL, PARAMETER :: arr1(n:*) = SQRT ((/ 1.0, 2.0, 3.0 /)) + 42
16 ! With dimension statement.
17 REAL, DIMENSION(*), PARAMETER :: arr2 = arr1
20 INTEGER, PARAMETER :: arr3(n:*, *) = RESHAPE ((/ 1, 2, 3, 4 /), (/ 2, 2/))
23 CHARACTER(LEN=*), PARAMETER :: arr4(*) = (/ CHARACTER(LEN=3) :: "ab", "cde" /)
25 IF (LBOUND (arr1, 1) /= n .OR. UBOUND (arr1, 1) /= n + 2) CALL abort ()
26 IF (SIZE (arr1) /= 3) CALL abort ()
28 IF (LBOUND (arr2, 1) /= 1 .OR. UBOUND (arr2, 1) /= 3) CALL abort ()
29 IF (SIZE (arr2) /= 3) CALL abort ()
31 IF (ANY (LBOUND (arr3) /= (/ n, 1 /) .OR. UBOUND (arr3) /= (/ n + 1, 2 /))) &
33 IF (SIZE (arr3) /= 4) CALL abort ()
35 IF (LBOUND (arr4, 1) /= 1 .OR. UBOUND (arr4, 1) /= 2) CALL abort ()
36 IF (SIZE (arr4) /= 2) CALL abort ()