PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_parameter_2.f90
blob4586ff514ffae7b5d3fa0a17f9565ee33e85cb0c
1 ! { dg-do run }
2 ! { dg-options "-ffree-form -std=legacy" }
4 ! Test DEC-style PARAMETER statements without parentheses in free form.
7 subroutine sub1(t, x, y)
8 implicit real(8) (A-H,O-Z)
9 parameter (pi_1 = 3.141592654d0, f_1 = 3.d08)
10 parameter pi_2 = 3.141592654d0, f_2 = 3.d08 ! legacy PARAMETER
11 ! Note that if the parameter statements above are matched
12 ! incorrectly as assignments, the below specification
13 ! statements will be considered out-of-order and we see
14 ! 'unexpected specification statement'. A PARAMETER
15 ! statement should still be a specification statement.
17 real(8), intent(in) :: t
18 real(8), intent(out) :: x, y
20 real(8), volatile :: two
21 two = 2.0d0
22 x = two * pi_1 * f_1 * t
23 y = two * pi_2 * f_2 * t
24 return
25 end subroutine
27 subroutine sub2(t, x, y, z)
28 implicit none
29 real(8) :: pi_1, pi_2, f_1, f_2
30 parameter (pi_1 = 3.141592654d0, f_1 = 3.d08)
31 parameter pi_2 = 3.141592654d0, f_2 = 3.d08 ! legacy PARAMETER
32 real(8), parameter :: pi_3 = 3.141592654d0, f_3 = 3.d08
33 ! Ditto sub1
35 real(8), intent(in) :: t
36 real(8), intent(out) :: x, y, z
38 real(8), volatile :: two
39 two = 2.0d0
40 x = two * pi_1 * f_1 * t
41 y = two * pi_2 * f_2 * t
42 z = two * pi_3 * f_3 * t
43 end subroutine
45 implicit none
46 real(8) :: x1, x2, y1, y2, z2
47 real(8), volatile :: t
48 t = 1.5e-6
50 call sub1(t, x1, y1)
51 call sub2(t, x2, y2, z2)
53 write(*,'(4D18.5)') t, x1, y1
54 write(*,'(4D18.5)') t, x2, y2, z2
56 if (x1 .ne. x2 .or. y1 .ne. y2 &
57 .or. x1 .ne. y1 .or. x2 .ne. y2 &
58 .or. y2 .ne. z2) then
59 STOP 1
60 endif
62 end