File: initializers.f

package info (click to toggle)
ftnchek 3.3.1-7
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,684 kB
  • sloc: ansic: 21,908; fortran: 5,748; yacc: 4,071; sh: 3,035; makefile: 895; lisp: 322; f90: 118; perl: 76
file content (47 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (5)
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
C  Testing syntax recognition and assignment type checking of
C  standard and non-standard initializing declarations.

C  Here we use modern standard F90 initializers
      subroutine f90
      integer :: m, n = 100
C ftnchek does not recognize the following one yet
      integer, dimension(5) :: a = (/ 1, 2, 3, 4, 5 /)
      real :: pi = 3.14159265358979d0
      character :: c = 32   ! type mismatch
      integer :: q = 'hello'   ! type mismatch
      print *, 'F90 initializers:'
      print *, m, n, a   ! m used before set
      print *, pi, c, q
      end
C  Here we use archaic but standard F77 separate type decls and data stmts
      subroutine f77
      integer m, n, a(5)
      real pi
      character c
      integer q
      data n / 100 /
      data a /  1, 2, 3, 4, 5 /
      data pi / 3.14159265358979d0 /
      data c / 32 /   ! type mismatch
      data q / 'hello' /   ! type mismatch
      print *, 'F77 initializers:'
      print *, m, n, a   ! m used before set
      print *, pi, c, q
      end
C  This one uses "bastard" initializer form.
      subroutine bastard
      integer m, n / 100 /, a(5) / 1, 2, 3, 4, 5 /
      real pi / 3.14159265358979d0 /
      character c / 32 /   ! type mismatch
      integer q / 'hello' /   ! type mismatch
      print *, 'bastard initializers:'
      print *, m, n, a   ! m used before set
      print *, pi, c, q
      end
C  Main program just suppresses "never invoked" warnings.
      program main
      call f90
      call f77
      call bastard
      end