File: dec_parameter_1.f

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (63 lines) | stat: -rw-r--r-- 1,947 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
        ! { dg-do run }
        ! { dg-options "-ffixed-form -std=legacy" }
        !
        ! Test DEC-style PARAMETER statements without parentheses in
        ! fixed form.
        !

        subroutine sub1(t, x, y)
          implicit real(8) (A-H,O-Z)
          parameter   (pi_1 = 3.141592654d0, f_1 = 3.d08)
          parameter    pi_2 = 3.141592654d0, f_2 = 3.d08
          ! Note that if the parameter statements above are matched
          ! incorrectly as assignments, the below specification
          ! statements will be considered out-of-order and we see
          ! 'unexpected specification statement'. A PARAMETER
          ! statement should still be a specification statement.

          real(8), intent(in) :: t
          real(8), intent(out) :: x, y

          real(8), volatile :: two
          two = 2.0d0
          x = two * pi_1 * f_1 * t
          y = two * pi_2 * f_2 * t
          return
        end subroutine

        subroutine sub2(t, x, y, z)
          implicit none
          real(8) :: pi_1, pi_2, f_1, f_2
                   parameter   (pi_1 = 3.141592654d0, f_1 = 3.d08)
                   parameter    pi_2 = 3.141592654d0, f_2 = 3.d08
          real(8), parameter :: pi_3 = 3.141592654d0, f_3 = 3.d08
          ! Ditto sub1

          real(8), intent(in) :: t
          real(8), intent(out) :: x, y, z

          real(8), volatile :: two
          two = 2.0d0
          x = two * pi_1 * f_1 * t
          y = two * pi_2 * f_2 * t
          z = two * pi_3 * f_3 * t
        end subroutine

        implicit none
        real(8) :: x1, x2, y1, y2, z2
        real(8), volatile :: t
        t = 1.5e-6

        call sub1(t, x1, y1)
        call sub2(t, x2, y2, z2)

        write(*,'(4D18.5)') t, x1, y1
        write(*,'(4D18.5)') t, x2, y2, z2

        if (x1 .ne. x2 .or. y1 .ne. y2
     &      .or. x1 .ne. y1 .or. x2 .ne. y2
     &      .or. y2 .ne. z2) then
          STOP 1
        endif

        end