1 !==================initialization_1.f90======================
4 ! Tests fix for PR25018 in which an ICE resulted from using a
5 ! variable in a parameter initialization expression. In the course
6 ! of developing the fix, various other constraints and limitations
9 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
12 ! The next line is the original error
13 real(8), parameter :: g
= - sqrt(2._8
) * Gf
! { dg-error "not been declared or is a variable" }
15 subroutine foo(ch1
, x
, y
)
18 ! This is OK because it is a restricted expression.
19 character(len(ch1
)) :: ch2
24 ! However, this gives a warning because it is an initialization expression.
25 integer :: l1
= len (ch1
) ! { dg-warning "assumed character length variable" }
27 ! Dependence on upper bound of final dimension of assumed size array knocks these out.
28 integer :: m1
= size (x
, 2) ! { dg-error "not a valid dimension index" }
29 integer :: m2(2) = shape (x
) ! { dg-error "assumed size array" }
31 ! These are warnings because they are gfortran extensions.
32 integer :: m3
= size (x
, 1) ! { dg-warning "Evaluation of nonstandard initialization" }
33 integer :: m4(2) = shape (z
) ! { dg-warning "Evaluation of nonstandard initialization" }
35 ! This does not depend on non-constant properties.
36 real(8) :: big
= huge (x
)