xref: /original-bsd/usr.bin/f77/tests/tests/fm019.f (revision 5e36add1)
1c
2c     comment section.
3c
4c     fm019
5c
6c           this routine continues tests of the fortran logical if state
7c     by testing various forms of relational expressions with arithmetic
8c     expressions .  positive and negative signs are used in conjunction
9c     with parentheses. combinations of logical  .and.    .or.
10c     .not. are used to test the more complex expressions.
11c
12c      references
13c        american national standard programming language fortran,
14c              x3.9-1978
15c
16c        section 4.7.1, logical constant
17c        section 6, expressions
18c        section 11.5, logical if statement
19c
20      logical lctnt1, lctnt2
21c
22c      **********************************************************
23c
24c         a compiler validation system for the fortran language
25c     based on specifications as defined in american national standard
26c     programming language fortran x3.9-1978, has been developed by the
27c     federal cobol compiler testing service.  the fortran compiler
28c     validation system (fcvs) consists of audit routines, their related
29c     data, and an executive system.  each audit routine is a fortran
30c     program, subprogram or function which includes tests of specific
31c     language elements and supporting procedures indicating the result
32c     of executing these tests.
33c
34c         this particular program/subprogram/function contains features
35c     found only in the subset as defined in x3.9-1978.
36c
37c         suggestions and comments should be forwarded to -
38c
39c                  department of the navy
40c                  federal cobol compiler testing service
41c                  washington, d.c.  20376
42c
43c      **********************************************************
44c
45c
46c
47c     initialization section
48c
49c     initialize constants
50c      **************
51c     i01 contains the logical unit number for the card reader.
52      i01 = 5
53c     i02 contains the logical unit number for the printer.
54      i02 = 6
55c     system environment section
56c
57cx010    this card is replaced by contents of fexec x-010 control card.
58c     the cx010 card is for overriding the program default i01 = 5
59c     (unit number for card reader).
60cx011    this card is replaced by contents of fexec x-011 control card.
61c     the cx011 card is for systems which require additional
62c     fortran statements for files associated with cx010 above.
63c
64cx020    this card is replaced by contents of fexec x-020 control card.
65c     the cx020 card is for overriding the program default i02 = 6
66c     (unit number for printer).
67cx021    this card is replaced by contents of fexec x-021 control card.
68c     the cx021 card is for systems which require additional
69c     fortran statements for files associated with cx020 above.
70c
71      ivpass=0
72      ivfail=0
73      ivdele=0
74      iczero=0
75c
76c     write page headers
77      write (i02,90000)
78      write (i02,90001)
79      write (i02,90002)
80      write (i02, 90002)
81      write (i02,90003)
82      write (i02,90002)
83      write (i02,90004)
84      write (i02,90002)
85      write (i02,90011)
86      write (i02,90002)
87      write (i02,90002)
88      write (i02,90005)
89      write (i02,90006)
90      write (i02,90002)
91      ivtnum = 530
92c
93c      ****  test 530  ****
94c     test 530  - test of positively signed term   +(ic) (ro) -(ic)
95c           .lt.  false path
96c
97      if (iczero) 35300, 5300, 35300
98 5300 continue
99      ivon01 = 1
100      if ( +3 .lt. -3)  ivon01 = 0
101      go to 45300
10235300 ivdele = ivdele + 1
103      write (i02,80003) ivtnum
104      if (iczero) 45300, 5311, 45300
10545300 if ( ivon01 - 1 )  25300, 15300, 25300
10615300 ivpass = ivpass + 1
107      write (i02,80001) ivtnum
108      go to 5311
10925300 ivfail = ivfail + 1
110      ivcomp = ivon01
111      ivcorr = 1
112      write (i02,80004) ivtnum, ivcomp ,ivcorr
113 5311 continue
114      ivtnum = 531
115c
116c      ****  test 531  ****
117c     test 531  -  test of signed zero     .lt.  false path
118c
119c
120      if (iczero) 35310, 5310, 35310
121 5310 continue
122      ivon01 = 1
123      if ( +0 .lt. -0 )  ivon01 = 0
124      go to 45310
12535310 ivdele = ivdele + 1
126      write (i02,80003) ivtnum
127      if (iczero) 45310, 5321, 45310
12845310 if ( ivon01 - 1 )  25310, 15310, 25310
12915310 ivpass = ivpass + 1
130      write (i02,80001) ivtnum
131      go to 5321
13225310 ivfail = ivfail + 1
133      ivcomp = ivon01
134      ivcorr = 1
135      write (i02,80004) ivtnum, ivcomp ,ivcorr
136 5321 continue
137      ivtnum = 532
138c
139c      ****  test 532  ****
140c     test 532  -  test of signed zero  .le.  true path
141c
142c
143      if (iczero) 35320, 5320, 35320
144 5320 continue
145      ivon01 = 0
146      if ( +0 .le. -0 )  ivon01 = 1
147      go to 45320
14835320 ivdele = ivdele + 1
149      write (i02,80003) ivtnum
150      if (iczero) 45320, 5331, 45320
15145320 if ( ivon01 - 1 )  25320, 15320, 25320
15215320 ivpass = ivpass + 1
153      write (i02,80001) ivtnum
154      go to 5331
15525320 ivfail = ivfail + 1
156      ivcomp = ivon01
157      ivcorr = 1
158      write (i02,80004) ivtnum, ivcomp ,ivcorr
159 5331 continue
160      ivtnum = 533
161c
162c      ****  test 533  ****
163c     test 533  -  test of signed zero  .eq.  true path
164c
165c
166      if (iczero) 35330, 5330, 35330
167 5330 continue
168      ivon01 = 0
169      if ( +0 .eq. -0 )  ivon01 = 1
170      go to 45330
17135330 ivdele = ivdele + 1
172      write (i02,80003) ivtnum
173      if (iczero) 45330, 5341, 45330
17445330 if ( ivon01 - 1 )  25330, 15330, 25330
17515330 ivpass = ivpass + 1
176      write (i02,80001) ivtnum
177      go to 5341
17825330 ivfail = ivfail + 1
179      ivcomp = ivon01
180      ivcorr = 1
181      write (i02,80004) ivtnum, ivcomp ,ivcorr
182 5341 continue
183      ivtnum = 534
184c
185c      ****  test 534  ****
186c     test 534  -  test of signed zero  .ne.  false path
187c
188c
189      if (iczero) 35340, 5340, 35340
190 5340 continue
191      ivon01 = 1
192      if ( +0 .ne. -0 )  ivon01 = 0
193      go to 45340
19435340 ivdele = ivdele + 1
195      write (i02,80003) ivtnum
196      if (iczero) 45340, 5351, 45340
19745340 if ( ivon01 - 1 )  25340, 15340, 25340
19815340 ivpass = ivpass + 1
199      write (i02,80001) ivtnum
200      go to 5351
20125340 ivfail = ivfail + 1
202      ivcomp = ivon01
203      ivcorr = 1
204      write (i02,80004) ivtnum, ivcomp ,ivcorr
205 5351 continue
206      ivtnum = 535
207c
208c      ****  test 535  ****
209c     test 535  -  test of signed zero  .ge.  true path
210c
211c
212      if (iczero) 35350, 5350, 35350
213 5350 continue
214      ivon01 = 0
215      if ( +0 .ge. -0 )  ivon01 = 1
216      go to 45350
21735350 ivdele = ivdele + 1
218      write (i02,80003) ivtnum
219      if (iczero) 45350, 5361, 45350
22045350 if ( ivon01 - 1 )  25350, 15350, 25350
22115350 ivpass = ivpass + 1
222      write (i02,80001) ivtnum
223      go to 5361
22425350 ivfail = ivfail + 1
225      ivcomp = ivon01
226      ivcorr = 1
227      write (i02,80004) ivtnum, ivcomp ,ivcorr
228 5361 continue
229      ivtnum = 536
230c
231c      ****  test 536  ****
232c     test 536  -  test of signed zero  .gt.  false path
233c
234c
235      if (iczero) 35360, 5360, 35360
236 5360 continue
237      ivon01 = 1
238      if ( +0 .gt. -0 )  ivon01 = 0
239      go to 45360
24035360 ivdele = ivdele + 1
241      write (i02,80003) ivtnum
242      if (iczero) 45360, 5371, 45360
24345360 if ( ivon01 - 1 )  25360, 15360, 25360
24415360 ivpass = ivpass + 1
245      write (i02,80001) ivtnum
246      go to 5371
24725360 ivfail = ivfail + 1
248      ivcomp = ivon01
249      ivcorr = 1
250      write (i02,80004) ivtnum, ivcomp ,ivcorr
251 5371 continue
252      ivtnum = 537
253c
254c      ****  test 537  ****
255c     test 537  -  test of +32767 .eq. -32766  false path
256c
257c
258      if (iczero) 35370, 5370, 35370
259 5370 continue
260      ivon01 = 1
261      if ( +32767 .eq. -32766 )  ivon01 = 0
262      go to 45370
26335370 ivdele = ivdele + 1
264      write (i02,80003) ivtnum
265      if (iczero) 45370, 5381, 45370
26645370 if ( ivon01 - 1 )  25370, 15370, 25370
26715370 ivpass = ivpass + 1
268      write (i02,80001) ivtnum
269      go to 5381
27025370 ivfail = ivfail + 1
271      ivcomp = ivon01
272      ivcorr = 1
273      write (i02,80004) ivtnum, ivcomp ,ivcorr
274 5381 continue
275      ivtnum = 538
276c
277c      ****  test 538  ****
278c     test 538  -  tests minus sign with integer variables
279c           relational expression uses  .le.  true path
280c
281c
282      if (iczero) 35380, 5380, 35380
283 5380 continue
284      ivon01 = 0
285      ivon02 = 3
286      if ( -ivon02 .le. -ivon02 )  ivon01 = 1
287      go to 45380
28835380 ivdele = ivdele + 1
289      write (i02,80003) ivtnum
290      if (iczero) 45380, 5391, 45380
29145380 if ( ivon01 - 1 )  25380, 15380, 25380
29215380 ivpass = ivpass + 1
293      write (i02,80001) ivtnum
294      go to 5391
29525380 ivfail = ivfail + 1
296      ivcomp = ivon01
297      ivcorr = 1
298      write (i02,80004) ivtnum, ivcomp ,ivcorr
299 5391 continue
300      ivtnum = 539
301c
302c      ****  test 539  ****
303c     test 539  -  test is like test 538   uses  .ge.  true path
304c
305c
306      if (iczero) 35390, 5390, 35390
307 5390 continue
308      ivon01 = 0
309      ivon02 = 32766
310      if ( -ivon02 .ge. -ivon02 )  ivon01 = 1
311      go to 45390
31235390 ivdele = ivdele + 1
313      write (i02,80003) ivtnum
314      if (iczero) 45390, 5401, 45390
31545390 if ( ivon01 - 1 )  25390, 15390, 25390
31615390 ivpass = ivpass + 1
317      write (i02,80001) ivtnum
318      go to 5401
31925390 ivfail = ivfail + 1
320      ivcomp = ivon01
321      ivcorr = 1
322      write (i02,80004) ivtnum, ivcomp ,ivcorr
323 5401 continue
324      ivtnum = 540
325c
326c      ****  test 540  ****
327c     test 540  -  integer exponientiation and minus sign  uses .ne.
328c           false path
329c
330c
331      if (iczero) 35400, 5400, 35400
332 5400 continue
333      ivon01 = 1
334      ivon02 = 3
335      if ( -ivon02 ** 3 .ne. -27 )  ivon01 = 0
336      go to 45400
33735400 ivdele = ivdele + 1
338      write (i02,80003) ivtnum
339      if (iczero) 45400, 5411, 45400
34045400 if ( ivon01 - 1 )  25400, 15400, 25400
34115400 ivpass = ivpass + 1
342      write (i02,80001) ivtnum
343      go to 5411
34425400 ivfail = ivfail + 1
345      ivcomp = ivon01
346      ivcorr = 1
347      write (i02,80004) ivtnum, ivcomp ,ivcorr
348 5411 continue
349      ivtnum = 541
350c
351c      ****  test 541  ****
352c     test 541  -  like test 540  uses  .le.  true path
353c
354c
355      if (iczero) 35410, 5410, 35410
356 5410 continue
357      ivon01 = 0
358      ivon02 = 3
359      if ( -3 ** ivon02  .le. -27 )  ivon01 = 1
360      go to 45410
36135410 ivdele = ivdele + 1
362      write (i02,80003) ivtnum
363      if (iczero) 45410, 5421, 45410
36445410 if ( ivon01 - 1 )  25410, 15410, 25410
36515410 ivpass = ivpass + 1
366      write (i02,80001) ivtnum
367      go to 5421
36825410 ivfail = ivfail + 1
369      ivcomp = ivon01
370      ivcorr = 1
371      write (i02,80004) ivtnum, ivcomp ,ivcorr
372 5421 continue
373      ivtnum = 542
374c
375c      ****  test 542  ****
376c     test 542  -  integer exponientiation and multiplication
377c           uses  .eq.  true path
378c
379c
380      if (iczero) 35420, 5420, 35420
381 5420 continue
382      ivon01 = 0
383      ivon02 = 3
384      ivon03 = 27
385      if ( -ivon02 ** 2 * ivon02 .eq. -ivon03 )  ivon01 = 1
386      go to 45420
38735420 ivdele = ivdele + 1
388      write (i02,80003) ivtnum
389      if (iczero) 45420, 5431, 45420
39045420 if ( ivon01 - 1 )  25420, 15420, 25420
39115420 ivpass = ivpass + 1
392      write (i02,80001) ivtnum
393      go to 5431
39425420 ivfail = ivfail + 1
395      ivcomp = ivon01
396      ivcorr = 1
397      write (i02,80004) ivtnum, ivcomp ,ivcorr
398 5431 continue
399      ivtnum = 543
400c
401c      ****  test 543  ****
402c     test 543  -  integer exponientiation and division
403c           uses  .lt.  true path
404c
405c
406      if (iczero) 35430, 5430, 35430
407 5430 continue
408      ivon01 = 0
409      ivon02 = 587
410      ivon03 = 3
411      ivon04 = 3
412      if ( -ivon02/ivon04 ** 3 .lt. -3 ** ivon03/ivon02 )  ivon01 = 1
413      go to 45430
41435430 ivdele = ivdele + 1
415      write (i02,80003) ivtnum
416      if (iczero) 45430, 5441, 45430
41745430 if ( ivon01 - 1 )  25430, 15430, 25430
41815430 ivpass = ivpass + 1
419      write (i02,80001) ivtnum
420      go to 5441
42125430 ivfail = ivfail + 1
422      ivcomp = ivon01
423      ivcorr = 1
424      write (i02,80004) ivtnum, ivcomp ,ivcorr
425 5441 continue
426      ivtnum = 544
427c
428c      ****  test 544  ****
429c     test 544  -  integer addition and subtraction
430c           uses  .eq.  true path
431c
432c
433      if (iczero) 35440, 5440, 35440
434 5440 continue
435      ivon01 = 0
436      ivon02 = 3
437      ivon03 = 587
438      if ( ivon02 - ivon03 .eq. -ivon03 + ivon02 )  ivon01 = 1
439      go to 45440
44035440 ivdele = ivdele + 1
441      write (i02,80003) ivtnum
442      if (iczero) 45440, 5451, 45440
44345440 if ( ivon01 - 1 )  25440, 15440, 25440
44415440 ivpass = ivpass + 1
445      write (i02,80001) ivtnum
446      go to 5451
44725440 ivfail = ivfail + 1
448      ivcomp = ivon01
449      ivcorr = 1
450      write (i02,80004) ivtnum, ivcomp ,ivcorr
451 5451 continue
452      ivtnum = 545
453c
454c      ****  test 545  ****
455c     test 545  -  integer addition and subtraction with parentheses
456c           uses  .eq.  true path  like test 544
457c
458c
459      if (iczero) 35450, 5450, 35450
460 5450 continue
461      ivon01 = 0
462      ivon02 = 3
463      ivon03 = 587
464      if ( (ivon02 - ivon03) .eq. (-ivon03 + ivon02) )  ivon01 = 1
465      go to 45450
46635450 ivdele = ivdele + 1
467      write (i02,80003) ivtnum
468      if (iczero) 45450, 5461, 45450
46945450 if ( ivon01 - 1 ) 25450, 15450, 25450
47015450 ivpass = ivpass + 1
471      write (i02,80001) ivtnum
472      go to 5461
47325450 ivfail = ivfail + 1
474      ivcomp = ivon01
475      ivcorr = 1
476      write (i02,80004) ivtnum, ivcomp ,ivcorr
477 5461 continue
478      ivtnum = 546
479c
480c      ****  test 546  ****
481c     test 546  -  integer exponientiation and division with parens
482c           uses  .lt.  true path
483c
484c
485      if (iczero) 35460, 5460, 35460
486 5460 continue
487      ivon01 = 0
488      ivon02 = 587
489      ivon03 = 3
490      ivon04 = 3
491      if ((-ivon02/(ivon04**3)).lt.((-3**ivon03)/ivon02))ivon01=1
492      go to 45460
49335460 ivdele = ivdele + 1
494      write (i02,80003) ivtnum
495      if (iczero) 45460, 5471, 45460
49645460 if ( ivon01 - 1 )  25460, 15460, 25460
49715460 ivpass = ivpass + 1
498      write (i02,80001) ivtnum
499      go to 5471
50025460 ivfail = ivfail + 1
501      ivcomp = ivon01
502      ivcorr = 1
503      write (i02,80004) ivtnum, ivcomp ,ivcorr
504 5471 continue
505      ivtnum = 547
506c
507c      ****  test 547  ****
508c     test 547  -  integer multiplication with parentheses  .lt.  false
509c
510c
511      if (iczero) 35470, 5470, 35470
512 5470 continue
513      ivon01 = 1
514      ivon02 = 587
515      if ((-3)*(-3).lt.(-ivon02))ivon01=0
516      go to 45470
51735470 ivdele = ivdele + 1
518      write (i02,80003) ivtnum
519      if (iczero) 45470, 5481, 45470
52045470 if ( ivon01 - 1 )  25470, 15470, 25470
52115470 ivpass = ivpass + 1
522      write (i02,80001) ivtnum
523      go to 5481
52425470 ivfail = ivfail + 1
525      ivcomp = ivon01
526      ivcorr = 1
527      write (i02,80004) ivtnum, ivcomp ,ivcorr
528 5481 continue
529      ivtnum = 548
530c
531c      ****  test 548  ****
532c     test 548  -  integer exponientiation, minus signs, and parentheses
533c           uses  .le.  true path
534c
535c
536      if (iczero) 35480, 5480, 35480
537 5480 continue
538      ivon01 = 0
539      ivon02 = 3
540      ivon03 = 27
541      if ( ((-ivon02) ** ivon02 .le. (-ivon03)))  ivon01 = 1
542      go to 45480
54335480 ivdele = ivdele + 1
544      write (i02,80003) ivtnum
545      if (iczero) 45480, 5491, 45480
54645480 if ( ivon01 - 1 )  25480, 15480, 25480
54715480 ivpass = ivpass + 1
548      write (i02,80001) ivtnum
549      go to 5491
55025480 ivfail = ivfail + 1
551      ivcomp = ivon01
552      ivcorr = 1
553      write (i02,80004) ivtnum, ivcomp ,ivcorr
554 5491 continue
555      ivtnum = 549
556c
557c      ****  test 549  ****
558c     test 549  -  test the order of integer arithmetic operations
559c           uses integer exponientiation, addition, multiplication,
560c           and parentheses.  also uses  .eq.  true path
561c           see section 6.1, arithmetic expressions.
562c
563c
564      if (iczero) 35490, 5490, 35490
565 5490 continue
566      ivon01 = 0
567      ivon02 = 3
568      if(ivon02 * ivon02/(ivon02+ivon02)**ivon02+ivon02 .eq. 3) ivon01=1
569      go to 45490
57035490 ivdele = ivdele + 1
571      write (i02,80003) ivtnum
572      if (iczero) 45490, 5501, 45490
57345490 if ( ivon01 - 1 )  25490, 15490, 25490
57415490 ivpass = ivpass + 1
575      write (i02,80001) ivtnum
576      go to 5501
57725490 ivfail = ivfail + 1
578      ivcomp = ivon01
579      ivcorr = 1
580      write (i02,80004) ivtnum, ivcomp ,ivcorr
581 5501 continue
582      ivtnum = 550
583c
584c      ****  test 550  ****
585c     test 550  -  combination of logical  .not. and  .and.
586c           .not. (lp) .and. .not. (lp)
587c           true path
588c
589c
590      if (iczero) 35500, 5500, 35500
591 5500 continue
592      ivon01 = 0
593      lctnt1 = .false.
594      if ( .not. .false. .and. .not. lctnt1 )  ivon01 = 1
595      go to 45500
59635500 ivdele = ivdele + 1
597      write (i02,80003) ivtnum
598      if (iczero) 45500, 5511, 45500
59945500 if ( ivon01 - 1 )  25500, 15500, 25500
60015500 ivpass = ivpass + 1
601      write (i02,80001) ivtnum
602      go to 5511
60325500 ivfail = ivfail + 1
604      ivcomp = ivon01
605      ivcorr = 1
606      write (i02,80004) ivtnum, ivcomp ,ivcorr
607 5511 continue
608      ivtnum = 551
609c
610c      ****  test 551  ****
611c     test 551  -  combination of logical .or. and .not.
612c           .not. (lp) .or. .not. (lp)
613c           true path
614c
615c
616      if (iczero) 35510, 5510, 35510
617 5510 continue
618      ivon01 = 0
619      lctnt1 = .true.
620      lctnt2 = .false.
621      if ( .not. lctnt1 .or. .not. lctnt2 )  ivon01 = 1
622      go to 45510
62335510 ivdele = ivdele + 1
624      write (i02,80003) ivtnum
625      if (iczero) 45510, 5521, 45510
62645510 if ( ivon01 - 1 )  25510, 15510, 25510
62715510 ivpass = ivpass + 1
628      write (i02,80001) ivtnum
629      go to 5521
63025510 ivfail = ivfail + 1
631      ivcomp = ivon01
632      ivcorr = 1
633      write (i02,80004) ivtnum, ivcomp ,ivcorr
634 5521 continue
635      ivtnum = 552
636c
637c      ****  test 552  ****
638c     test 552  -  combination of logical .and.  .or.  and  .not.
639c           .not. ( (le) .or. (lt) ) .and. .not. ( (lt) .and. (lf) )
640c           .not. is applied to a logical expression inclosed in parens
641c           false path
642c
643      if (iczero) 35520, 5520, 35520
644 5520 continue
645      ivon01 = 1
646      lctnt1 = .false.
647      lctnt2 = .true.
648      if(.not.(lctnt1.or.lctnt2).and..not.(lctnt1.and.lctnt2))ivon01 = 0
649      go to 45520
65035520 ivdele = ivdele + 1
651      write (i02,80003) ivtnum
652      if (iczero) 45520, 5531, 45520
65345520 if ( ivon01 - 1 )  25520, 15520, 25520
65415520 ivpass = ivpass + 1
655      write (i02,80001) ivtnum
656      go to 5531
65725520 ivfail = ivfail + 1
658      ivcomp = ivon01
659      ivcorr = 1
660      write (i02,80004) ivtnum, ivcomp ,ivcorr
661 5531 continue
662c
663c     write page footings and run summaries
66499999 continue
665      write (i02,90002)
666      write (i02,90006)
667      write (i02,90002)
668      write (i02,90002)
669      write (i02,90007)
670      write (i02,90002)
671      write (i02,90008)  ivfail
672      write (i02,90009) ivpass
673      write (i02,90010) ivdele
674c
675c
676c     terminate routine execution
677      stop
678c
679c     format statements for page headers
68090000 format (1h1)
68190002 format (1h )
68290001 format (1h ,10x,34hfortran compiler validation system)
68390003 format (1h ,21x,11hversion 1.0)
68490004 format (1h ,10x,38hfor official use only - copyright 1978)
68590005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
68690006 format (1h ,5x,46h----------------------------------------------)
68790011 format (1h ,18x,17hsubset level test)
688c
689c     format statements for run summaries
69090008 format (1h ,15x,i5,19h errors encountered)
69190009 format (1h ,15x,i5,13h tests passed)
69290010 format (1h ,15x,i5,14h tests deleted)
693c
694c     format statements for test results
69580001 format (1h ,4x,i5,7x,4hpass)
69680002 format (1h ,4x,i5,7x,4hfail)
69780003 format (1h ,4x,i5,7x,7hdeleted)
69880004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
69980005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
700c
70190007 format (1h ,20x,20hend of program fm019)
702      end
703