xref: /original-bsd/usr.bin/f77/tests/tests/fm028.f (revision 72b8f354)
1c     comment section
2c
3c     fm028
4c
5c         this routine contains the external function reference tests.
6c     the function subprogram ff029 is called by this program. the
7c     function subprogram ff029 increments the calling argument by 1
8c     and returns to the calling program.
9c
10c         execution of an external function reference results in an
11c     association of actual arguments with all appearances of dummy
12c     arguments in the defining subprogram.  following these
13c     associations, execution of the first executable statement of the
14c     defining subprogram is undertaken.
15c
16c      references
17c        american national standard programming language fortran,
18c              x3.9-1978
19c
20c        section 15.5.2, referencing an external function
21c
22      integer ff029
23c
24c
25c      **********************************************************
26c
27c         a compiler validation system for the fortran language
28c     based on specifications as defined in american national standard
29c     programming language fortran x3.9-1978, has been developed by the
30c     federal cobol compiler testing service.  the fortran compiler
31c     validation system (fcvs) consists of audit routines, their related
32c     data, and an executive system.  each audit routine is a fortran
33c     program, subprogram or function which includes tests of specific
34c     language elements and supporting procedures indicating the result
35c     of executing these tests.
36c
37c         this particular program/subprogram/function contains features
38c     found only in the subset as defined in x3.9-1978.
39c
40c         suggestions and comments should be forwarded to -
41c
42c                  department of the navy
43c                  federal cobol compiler testing service
44c                  washington, d.c.  20376
45c
46c      **********************************************************
47c
48c
49c
50c     initialization section
51c
52c     initialize constants
53c      **************
54c     i01 contains the logical unit number for the card reader.
55      i01 = 5
56c     i02 contains the logical unit number for the printer.
57      i02 = 6
58c     system environment section
59c
60cx010    this card is replaced by contents of fexec x-010 control card.
61c     the cx010 card is for overriding the program default i01 = 5
62c     (unit number for card reader).
63cx011    this card is replaced by contents of fexec x-011 control card.
64c     the cx011 card is for systems which require additional
65c     fortran statements for files associated with cx010 above.
66c
67cx020    this card is replaced by contents of fexec x-020 control card.
68c     the cx020 card is for overriding the program default i02 = 6
69c     (unit number for printer).
70cx021    this card is replaced by contents of fexec x-021 control card.
71c     the cx021 card is for systems which require additional
72c     fortran statements for files associated with cx020 above.
73c
74      ivpass=0
75      ivfail=0
76      ivdele=0
77      iczero=0
78c
79c     write page headers
80      write (i02,90000)
81      write (i02,90001)
82      write (i02,90002)
83      write (i02, 90002)
84      write (i02,90003)
85      write (i02,90002)
86      write (i02,90004)
87      write (i02,90002)
88      write (i02,90011)
89      write (i02,90002)
90      write (i02,90002)
91      write (i02,90005)
92      write (i02,90006)
93      write (i02,90002)
94c
95c     test section
96c
97c     external function reference
98c
99c     external function reference - argument name same as subprogram
100c              argument name.
101 6701 continue
102      ivtnum = 670
103c
104c     **** test 670 ****
105c
106      if (iczero) 36700,6700,36700
107 6700 continue
108      ivon01 = 0
109      ivcomp = ff029(ivon01)
110      go to 46700
11136700 ivdele = ivdele + 1
112      write (i02,80003) ivtnum
113      if (iczero) 46700,6711,46700
11446700 if (ivcomp - 1) 26700,16700,26700
11516700 ivpass = ivpass + 1
116      write (i02,80001) ivtnum
117      go to 6711
11826700 ivfail = ivfail + 1
119      ivcorr = 1
120      write (i02,80004) ivtnum, ivcomp, ivcorr
121 6711 continue
122      ivtnum = 671
123c
124c      ****  test 671  ****
125c
126c     external function reference - argument name same as internal
127c           variable in function subprogram.
128c
129      if (iczero) 36710,6710,36710
130 6710 continue
131      ivon02 = 2
132      ivon01 = 5
133      ivcomp = ff029(ivon02)
134      go to 46710
13536710 ivdele = ivdele + 1
136      write (i02,80003) ivtnum
137      if (iczero) 46710,6721,46710
13846710 if (ivcomp - 3) 26710,16710,26710
13916710 ivpass = ivpass + 1
140      write (i02,80001) ivtnum
141      go to 6721
14226710 ivfail = ivfail + 1
143      ivcorr = 3
144      write (i02,80004) ivtnum, ivcomp, ivcorr
145 6721 continue
146      ivtnum = 672
147c
148c     ****  test 672  ****
149c
150c     external function reference - argument name different from
151c           function subprogram argument and internal variable.
152c
153      if  (iczero) 36720,6720,36720
154 6720 continue
155      ivon01 = 7
156      ivon03 = -12
157      ivcomp = ff029(ivon03)
158      go to 46720
15936720 ivdele = ivdele + 1
160      write (i02,80003) ivtnum
161      if (iczero) 46720,6731,46720
16246720 if (ivcomp + 11) 26720,16720,26720
16316720 ivpass = ivpass + 1
164      write (i02,80001) ivtnum
165      go to 6731
16626720 ivfail = ivfail + 1
167      ivcorr = -11
168      write (i02,80004) ivtnum, ivcomp, ivcorr
169 6731 continue
170      ivtnum = 673
171c
172c      **** test 673  ****
173c
174c     repeated external function reference in a do loop.
175c
176      if (iczero) 36730,6730,36730
177 6730 continue
178      ivon01 = -7
179      ivcomp = 0
180      do 6732 ivon04 = 1,5
181      ivcomp = ff029(ivcomp)
182 6732 continue
183      go to 46730
18436730 ivdele = ivdele + 1
185      write (i02,80003) ivtnum
186      if (iczero) 46730,6741,46730
18746730 if (ivcomp - 5) 26730,16730,26730
18816730 ivpass = ivpass + 1
189      write (i02,80001) ivtnum
190      go to 6741
19126730 ivfail = ivfail + 1
192      ivcorr = 5
193      write (i02,80004) ivtnum, ivcomp, ivcorr
194 6741 continue
195c
196c     write page footings and run summaries
19799999 continue
198      write (i02,90002)
199      write (i02,90006)
200      write (i02,90002)
201      write (i02,90002)
202      write (i02,90007)
203      write (i02,90002)
204      write (i02,90008)  ivfail
205      write (i02,90009) ivpass
206      write (i02,90010) ivdele
207c
208c
209c     terminate routine execution
210      stop
211c
212c     format statements for page headers
21390000 format (1h1)
21490002 format (1h )
21590001 format (1h ,10x,34hfortran compiler validation system)
21690003 format (1h ,21x,11hversion 1.0)
21790004 format (1h ,10x,38hfor official use only - copyright 1978)
21890005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
21990006 format (1h ,5x,46h----------------------------------------------)
22090011 format (1h ,18x,17hsubset level test)
221c
222c     format statements for run summaries
22390008 format (1h ,15x,i5,19h errors encountered)
22490009 format (1h ,15x,i5,13h tests passed)
22590010 format (1h ,15x,i5,14h tests deleted)
226c
227c     format statements for test results
22880001 format (1h ,4x,i5,7x,4hpass)
22980002 format (1h ,4x,i5,7x,4hfail)
23080003 format (1h ,4x,i5,7x,7hdeleted)
23180004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
23280005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
233c
23490007 format (1h ,20x,20hend of program fm028)
235      end
236