xref: /original-bsd/usr.bin/f77/tests/tests/fm056.f (revision bff54947)
1c
2c     comment section
3c
4c     fm056
5c
6c          fm056 is a main which tests the argument passing linkage of
7c     a 2 level nested subroutine and an external function reference.
8c     the main program fm056 calls subroutine fs057 passing one
9c     argument.  subroutine fs057 calls subroutine fs058 passing two
10c     arguments.  subroutine fs058 references external function ff059
11c     passing 3 arguments.  function ff059 adds the values of the 3
12c     arguments together.  subroutine fs057 and fs058 then merely
13c     return the result to fm056 in the first argument.
14c
15c          the values of the arguments that are passed to each
16c     subprogram and function, and returned to the calling or
17c     referencing program are saved in an integer array.  fm056 then
18c     uses these values to test the compiler's argument passing
19c     capabilities.
20c
21c      references
22c        american national standard programming language fortran,
23c              x3.9-1978
24c
25c        section 15.6.2, subroutine reference
26      common iacn11 (12)
27c
28c      **********************************************************
29c
30c         a compiler validation system for the fortran language
31c     based on specifications as defined in american national standard
32c     programming language fortran x3.9-1978, has been developed by the
33c     federal cobol compiler testing service.  the fortran compiler
34c     validation system (fcvs) consists of audit routines, their related
35c     data, and an executive system.  each audit routine is a fortran
36c     program, subprogram or function which includes tests of specific
37c     language elements and supporting procedures indicating the result
38c     of executing these tests.
39c
40c         this particular program/subprogram/function contains features
41c     found only in the subset as defined in x3.9-1978.
42c
43c         suggestions and comments should be forwarded to -
44c
45c                  department of the navy
46c                  federal cobol compiler testing service
47c                  washington, d.c.  20376
48c
49c      **********************************************************
50c
51c
52c
53c     initialization section
54c
55c     initialize constants
56c      **************
57c     i01 contains the logical unit number for the card reader.
58      i01 = 5
59c     i02 contains the logical unit number for the printer.
60      i02 = 6
61c     system environment section
62c
63cx010    this card is replaced by contents of fexec x-010 control card.
64c     the cx010 card is for overriding the program default i01 = 5
65c     (unit number for card reader).
66cx011    this card is replaced by contents of fexec x-011 control card.
67c     the cx011 card is for systems which require additional
68c     fortran statements for files associated with cx010 above.
69c
70cx020    this card is replaced by contents of fexec x-020 control card.
71c     the cx020 card is for overriding the program default i02 = 6
72c     (unit number for printer).
73cx021    this card is replaced by contents of fexec x-021 control card.
74c     the cx021 card is for systems which require additional
75c     fortran statements for files associated with cx020 above.
76c
77      ivpass=0
78      ivfail=0
79      ivdele=0
80      iczero=0
81c
82c     write page headers
83      write (i02,90000)
84      write (i02,90001)
85      write (i02,90002)
86      write (i02, 90002)
87      write (i02,90003)
88      write (i02,90002)
89      write (i02,90004)
90      write (i02,90002)
91      write (i02,90011)
92      write (i02,90002)
93      write (i02,90002)
94      write (i02,90005)
95      write (i02,90006)
96      write (i02,90002)
97c
98c     test section
99c
100c         subroutine subprogram
101c
102      ivon01 = 5
103      call fs057 (ivon01)
104      iacn11 (12) = ivon01
105      ivtnum = 430
106c
107c      ****  test 430  ****
108c
109c     test 430 tests the value of the argument received by fs057 from
110c     a fm056 call to fs057
111c
112      if (iczero) 34300, 4300, 34300
113 4300 continue
114      ivcomp = iacn11 (1)
115      go to 44300
11634300 ivdele = ivdele + 1
117      write (i02,80003) ivtnum
118      if (iczero) 44300, 4311, 44300
11944300 if (ivcomp - 5) 24300,14300,24300
12014300 ivpass = ivpass + 1
121      write (i02,80001) ivtnum
122      go to 4311
12324300 ivfail = ivfail + 1
124      ivcorr = 5
125      write (i02,80004) ivtnum, ivcomp ,ivcorr
126 4311 continue
127      ivtnum = 431
128c
129c      ****  test 431  ****
130c
131c     test 431 tests the value of the second argument that was passed
132c     from a fs057 call to fs058
133c
134c
135      if (iczero) 34310, 4310, 34310
136 4310 continue
137      ivcomp = iacn11 (2)
138      go to 44310
13934310 ivdele = ivdele + 1
140      write (i02,80003) ivtnum
141      if (iczero) 44310, 4321, 44310
14244310 if (ivcomp - 4) 24310,14310,24310
14314310 ivpass = ivpass + 1
144      write (i02,80001) ivtnum
145      go to 4321
14624310 ivfail = ivfail + 1
147      ivcorr = 4
148      write (i02,80004) ivtnum, ivcomp ,ivcorr
149 4321 continue
150      ivtnum = 432
151c
152c      ****  test 432  ****
153c
154c     test 432 tests the value of the first argument received by fs058
155c     from a fs057 call to fs058
156c
157c
158      if (iczero) 34320, 4320, 34320
159 4320 continue
160      ivcomp = iacn11 (3)
161      go to 44320
16234320 ivdele = ivdele + 1
163      write (i02,80003) ivtnum
164      if (iczero) 44320, 4331, 44320
16544320 if (ivcomp - 5) 24320,14320,24320
16614320 ivpass = ivpass + 1
167      write (i02,80001) ivtnum
168      go to 4331
16924320 ivfail = ivfail + 1
170      ivcorr = 5
171      write (i02,80004) ivtnum, ivcomp ,ivcorr
172 4331 continue
173      ivtnum = 433
174c
175c      ****  test 433  ****
176c
177c     test 433 tests the value of the second argument received by fs058
178c     from a fs057 call to fs058
179c
180c
181      if (iczero) 34330, 4330, 34330
182 4330 continue
183      ivcomp = iacn11 (4)
184      go to 44330
18534330 ivdele = ivdele + 1
186      write (i02,80003) ivtnum
187      if (iczero) 44330, 4341, 44330
18844330 if (ivcomp - 4) 24330,14330,24330
18914330 ivpass = ivpass + 1
190      write (i02,80001) ivtnum
191      go to 4341
19224330 ivfail = ivfail + 1
193      ivcorr = 4
194      write (i02,80004) ivtnum, ivcomp ,ivcorr
195 4341 continue
196      ivtnum = 434
197c
198c      ****  test 434  ****
199c
200c     test 434 tests the value of the third argument that was passed
201c     from a fs058 reference of function ff059
202c
203c
204      if (iczero) 34340, 4340, 34340
205 4340 continue
206      ivcomp = iacn11 (5)
207      go to 44340
20834340 ivdele = ivdele + 1
209      write (i02,80003) ivtnum
210      if (iczero) 44340, 4351, 44340
21144340 if (ivcomp - 3) 24340,14340,24340
21214340 ivpass = ivpass + 1
213      write (i02,80001) ivtnum
214      go to 4351
21524340 ivfail = ivfail + 1
216      ivcorr = 3
217      write (i02,80004) ivtnum, ivcomp ,ivcorr
218 4351 continue
219      ivtnum = 435
220c
221c      ****  test 435  ****
222c
223c     test 435 tests the value of the first argument received by ff059
224c     from a fs058 reference of function ff059
225c
226c
227      if (iczero) 34350, 4350, 34350
228 4350 continue
229      ivcomp = iacn11 (6)
230      go to 44350
23134350 ivdele = ivdele + 1
232      write (i02,80003) ivtnum
233      if (iczero) 44350, 4361, 44350
23444350 if (ivcomp - 5) 24350,14350,24350
23514350 ivpass = ivpass + 1
236      write (i02,80001) ivtnum
237      go to 4361
23824350 ivfail = ivfail + 1
239      ivcorr = 5
240      write (i02,80004) ivtnum, ivcomp ,ivcorr
241 4361 continue
242      ivtnum = 436
243c
244c      ****  test 436  ****
245c
246c     test 436 tests the value of the second argument received by ff059
247c     from a fs058 reference of function ff059
248c
249c
250      if (iczero) 34360, 4360, 34360
251 4360 continue
252      ivcomp = iacn11 (7)
253      go to 44360
25434360 ivdele = ivdele + 1
255      write (i02,80003) ivtnum
256      if (iczero) 44360, 4371, 44360
25744360 if (ivcomp - 4) 24360,14360,24360
25814360 ivpass = ivpass + 1
259      write (i02,80001) ivtnum
260      go to 4371
26124360 ivfail = ivfail + 1
262      ivcorr = 4
263      write (i02,80004) ivtnum, ivcomp ,ivcorr
264 4371 continue
265      ivtnum = 437
266c
267c      ****  test 437  ****
268c
269c     test 437 tests the value of the third argument received by ff059
270c     from a fs058 reference of function ff059
271c
272c
273      if (iczero) 34370, 4370, 34370
274 4370 continue
275      ivcomp = iacn11 (8)
276      go to 44370
27734370 ivdele = ivdele + 1
278      write (i02,80003) ivtnum
279      if (iczero) 44370, 4381, 44370
28044370 if (ivcomp - 3) 24370,14370,24370
28114370 ivpass = ivpass + 1
282      write (i02,80001) ivtnum
283      go to 4381
28424370 ivfail = ivfail + 1
285      ivcorr = 3
286      write (i02,80004) ivtnum, ivcomp ,ivcorr
287 4381 continue
288      ivtnum = 438
289c
290c      ****  test 438  ****
291c
292c     test 438 tests the value of the function determined by ff059
293c
294c
295      if (iczero) 34380, 4380, 34380
296 4380 continue
297      ivcomp = iacn11 (9)
298      go to 44380
29934380 ivdele = ivdele + 1
300      write (i02,80003) ivtnum
301      if (iczero) 44380, 4391, 44380
30244380 if (ivcomp - 12) 24380,14380,24380
30314380 ivpass = ivpass + 1
304      write (i02,80001) ivtnum
305      go to 4391
30624380 ivfail = ivfail + 1
307      ivcorr = 12
308      write (i02,80004) ivtnum, ivcomp ,ivcorr
309 4391 continue
310      ivtnum = 439
311c
312c      ****  test 439  ****
313c
314c     test 439 tests the value of the function returned to fs058 by
315c     ff059
316c
317c
318      if (iczero) 34390, 4390, 34390
319 4390 continue
320      ivcomp = iacn11 (10)
321      go to 44390
32234390 ivdele = ivdele + 1
323      write (i02,80003) ivtnum
324      if (iczero) 44390, 4401, 44390
32544390 if (ivcomp - 12) 24390,14390,24390
32614390 ivpass = ivpass + 1
327      write (i02,80001) ivtnum
328      go to 4401
32924390 ivfail = ivfail + 1
330      ivcorr = 12
331      write (i02,80004) ivtnum, ivcomp ,ivcorr
332 4401 continue
333      ivtnum = 440
334c
335c      ****  test 440  ****
336c
337c     test 440 tests the value of the first argument returned to fs057
338c     by fs058
339c
340      if (iczero) 34400, 4400, 34400
341 4400 continue
342      ivcomp = iacn11 (11)
343      go to 44400
34434400 ivdele = ivdele + 1
345      write (i02,80003) ivtnum
346      if (iczero) 44400, 4411, 44400
34744400 if (ivcomp - 12) 24400,14400,24400
34814400 ivpass = ivpass + 1
349      write (i02,80001) ivtnum
350      go to 4411
35124400 ivfail = ivfail + 1
352      ivcorr = 12
353      write (i02,80004) ivtnum, ivcomp ,ivcorr
354 4411 continue
355      ivtnum = 441
356c
357c      ****  test 441  ****
358c
359c     test 441 tests the value of the first argument returned to fm056
360c     by fs057
361c
362c
363      if (iczero) 34410, 4410, 34410
364 4410 continue
365      ivcomp = iacn11 (12)
366      go to 44410
36734410 ivdele = ivdele + 1
368      write (i02,80003) ivtnum
369      if (iczero) 44410, 4421, 44410
37044410 if (ivcomp - 12) 24410,14410,24410
37114410 ivpass = ivpass + 1
372      write (i02,80001) ivtnum
373      go to 4421
37424410 ivfail = ivfail + 1
375      ivcorr = 12
376      write (i02,80004) ivtnum, ivcomp ,ivcorr
377 4421 continue
378c
379c     write page footings and run summaries
38099999 continue
381      write (i02,90002)
382      write (i02,90006)
383      write (i02,90002)
384      write (i02,90002)
385      write (i02,90007)
386      write (i02,90002)
387      write (i02,90008)  ivfail
388      write (i02,90009) ivpass
389      write (i02,90010) ivdele
390c
391c
392c     terminate routine execution
393      stop
394c
395c     format statements for page headers
39690000 format (1h1)
39790002 format (1h )
39890001 format (1h ,10x,34hfortran compiler validation system)
39990003 format (1h ,21x,11hversion 1.0)
40090004 format (1h ,10x,38hfor official use only - copyright 1978)
40190005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
40290006 format (1h ,5x,46h----------------------------------------------)
40390011 format (1h ,18x,17hsubset level test)
404c
405c     format statements for run summaries
40690008 format (1h ,15x,i5,19h errors encountered)
40790009 format (1h ,15x,i5,13h tests passed)
40890010 format (1h ,15x,i5,14h tests deleted)
409c
410c     format statements for test results
41180001 format (1h ,4x,i5,7x,4hpass)
41280002 format (1h ,4x,i5,7x,4hfail)
41380003 format (1h ,4x,i5,7x,7hdeleted)
41480004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
41580005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
416c
41790007 format (1h ,20x,20hend of program fm056)
418      end
419