1c comment section 2c 3c fm037 4c 5c this routine tests arithmetic assignment statements of the 6c form 7c integer variable = arithmetic expression 8c where the arithmetic expression is formed with three integer 9c constants and the arithmetic operator /. both positive and nega- 10c tive constants are used in the arithmetic expression. 11c 12c there are tests which require no truncation of the result 13c and tests where the result must be truncated before being stored 14c in the resultant integer variable. the standard states 'the value 15c of an integer factor or term is the nearest integer whose magni- 16c tude does not exceed the magnitude of the mathematical value 17c represented by that factor or term. the associative and commuta- 18c tive laws do not apply in the evaluation of integer terms con- 19c taining division, hence the evaluation of such terms must effec- 20c tively proceed from left to right.' 21c 22c there are tests where the arithmetic expression contains 23c (1) integer constant/integer constant/integer constant 24c no truncation required 25c (2) integer constant/integer constant/integer constant 26c truncation required 27c 28c references 29c american national standard programming language fortran, 30c x3.9-1978 31c 32c section 4.3, integer type 33c section 4.3.1, integer constant 34c section 6.1, arithmetic expressions 35c section 6.6, evaluation of expressions 36c section 10.1, arithmetic assignment statement 37c 38c ********************************************************** 39c 40c a compiler validation system for the fortran language 41c based on specifications as defined in american national standard 42c programming language fortran x3.9-1978, has been developed by the 43c federal cobol compiler testing service. the fortran compiler 44c validation system (fcvs) consists of audit routines, their related 45c data, and an executive system. each audit routine is a fortran 46c program, subprogram or function which includes tests of specific 47c language elements and supporting procedures indicating the result 48c of executing these tests. 49c 50c this particular program/subprogram/function contains features 51c found only in the subset as defined in x3.9-1978. 52c 53c suggestions and comments should be forwarded to - 54c 55c department of the navy 56c federal cobol compiler testing service 57c washington, d.c. 20376 58c 59c ********************************************************** 60c 61c 62c 63c initialization section 64c 65c initialize constants 66c ************** 67c i01 contains the logical unit number for the card reader. 68 i01 = 5 69c i02 contains the logical unit number for the printer. 70 i02 = 6 71c system environment section 72c 73cx010 this card is replaced by contents of fexec x-010 control card. 74c the cx010 card is for overriding the program default i01 = 5 75c (unit number for card reader). 76cx011 this card is replaced by contents of fexec x-011 control card. 77c the cx011 card is for systems which require additional 78c fortran statements for files associated with cx010 above. 79c 80cx020 this card is replaced by contents of fexec x-020 control card. 81c the cx020 card is for overriding the program default i02 = 6 82c (unit number for printer). 83cx021 this card is replaced by contents of fexec x-021 control card. 84c the cx021 card is for systems which require additional 85c fortran statements for files associated with cx020 above. 86c 87 ivpass=0 88 ivfail=0 89 ivdele=0 90 iczero=0 91c 92c write page headers 93 write (i02,90000) 94 write (i02,90001) 95 write (i02,90002) 96 write (i02, 90002) 97 write (i02,90003) 98 write (i02,90002) 99 write (i02,90004) 100 write (i02,90002) 101 write (i02,90011) 102 write (i02,90002) 103 write (i02,90002) 104 write (i02,90005) 105 write (i02,90006) 106 write (i02,90002) 107c 108c test section 109c 110c arithmetic assignment statement 111c 112c test 491 through test 519 contain three integer constants and 113c operator / in an arithmetic expression. the form tested is 114c integer variable = integer constant/integer constant/int.con. 115c 116c 117c test 491 through test 496 - positive integer constants 118c no truncation required 119c 120 4911 continue 121 ivtnum = 491 122c 123c **** test 491 **** 124c 125 if (iczero) 34910, 4910, 34910 126 4910 continue 127 ivcomp = 24/3/4 128 go to 44910 12934910 ivdele = ivdele + 1 130 write (i02,80003) ivtnum 131 if (iczero) 44910, 4921, 44910 13244910 if (ivcomp - 2) 24910,14910,24910 13314910 ivpass = ivpass + 1 134 write (i02,80001) ivtnum 135 go to 4921 13624910 ivfail = ivfail + 1 137 ivcorr = 2 138 write (i02,80004) ivtnum, ivcomp ,ivcorr 139 4921 continue 140 ivtnum = 492 141c 142c **** test 492 **** 143c 144 if (iczero) 34920, 4920, 34920 145 4920 continue 146 ivcomp = 330/3/2 147 go to 44920 14834920 ivdele = ivdele + 1 149 write (i02,80003) ivtnum 150 if (iczero) 44920, 4931, 44920 15144920 if (ivcomp - 55) 24920,14920,24920 15214920 ivpass = ivpass + 1 153 write (i02,80001) ivtnum 154 go to 4931 15524920 ivfail = ivfail + 1 156 ivcorr = 55 157 write (i02,80004) ivtnum, ivcomp ,ivcorr 158 4931 continue 159 ivtnum = 493 160c 161c **** test 493 **** 162c 163 if (iczero) 34930, 4930, 34930 164 4930 continue 165 ivcomp = 15249/13/51 166 go to 44930 16734930 ivdele = ivdele + 1 168 write (i02,80003) ivtnum 169 if (iczero) 44930, 4941, 44930 17044930 if (ivcomp - 23) 24930,14930,24930 17114930 ivpass = ivpass + 1 172 write (i02,80001) ivtnum 173 go to 4941 17424930 ivfail = ivfail + 1 175 ivcorr = 23 176 write (i02,80004) ivtnum, ivcomp ,ivcorr 177 4941 continue 178 ivtnum = 494 179c 180c **** test 494 **** 181c 182 if (iczero) 34940, 4940, 34940 183 4940 continue 184 ivcomp = 7150/2/25 185 go to 44940 18634940 ivdele = ivdele + 1 187 write (i02,80003) ivtnum 188 if (iczero) 44940, 4951, 44940 18944940 if (ivcomp - 143) 24940,14940,24940 19014940 ivpass = ivpass + 1 191 write (i02,80001) ivtnum 192 go to 4951 19324940 ivfail = ivfail + 1 194 ivcorr = 143 195 write (i02,80004) ivtnum, ivcomp ,ivcorr 196 4951 continue 197 ivtnum = 495 198c 199c **** test 495 **** 200c 201 if (iczero) 34950, 4950, 34950 202 4950 continue 203 ivcomp = 32766/2/3 204 go to 44950 20534950 ivdele = ivdele + 1 206 write (i02,80003) ivtnum 207 if (iczero) 44950, 4961, 44950 20844950 if (ivcomp - 5461) 24950,14950,24950 20914950 ivpass = ivpass + 1 210 write (i02,80001) ivtnum 211 go to 4961 21224950 ivfail = ivfail + 1 213 ivcorr = 5461 214 write (i02,80004) ivtnum, ivcomp ,ivcorr 215 4961 continue 216 ivtnum = 496 217c 218c **** test 496 **** 219c 220 if (iczero) 34960, 4960, 34960 221 4960 continue 222 ivcomp = 32766/1/1 223 go to 44960 22434960 ivdele = ivdele + 1 225 write (i02,80003) ivtnum 226 if (iczero) 44960, 4971, 44960 22744960 if (ivcomp - 32766) 24960,14960,24960 22814960 ivpass = ivpass + 1 229 write (i02,80001) ivtnum 230 go to 4971 23124960 ivfail = ivfail + 1 232 ivcorr = 32766 233 write (i02,80004) ivtnum, ivcomp ,ivcorr 234c 235c test 497 through test 502 - positive integer constants 236c truncation required 237c 238 4971 continue 239 ivtnum = 497 240c 241c **** test 497 **** 242c 243 if (iczero) 34970, 4970, 34970 244 4970 continue 245 ivcomp = 24/3/3 246 go to 44970 24734970 ivdele = ivdele + 1 248 write (i02,80003) ivtnum 249 if (iczero) 44970, 4981, 44970 25044970 if (ivcomp -2) 24970,14970,24970 25114970 ivpass = ivpass + 1 252 write (i02,80001) ivtnum 253 go to 4981 25424970 ivfail = ivfail + 1 255 ivcorr = 2 256 write (i02,80004) ivtnum, ivcomp ,ivcorr 257 4981 continue 258 ivtnum = 498 259c 260c **** test 498 **** 261c 262 if (iczero) 34980, 4980, 34980 263 4980 continue 264 ivcomp = 230/2/3 265 go to 44980 26634980 ivdele = ivdele + 1 267 write (i02,80003) ivtnum 268 if (iczero) 44980, 4991, 44980 26944980 if (ivcomp - 38) 24980,14980,24980 27014980 ivpass = ivpass + 1 271 write (i02,80001) ivtnum 272 go to 4991 27324980 ivfail = ivfail + 1 274 ivcorr = 38 275 write (i02,80004) ivtnum, ivcomp ,ivcorr 276 4991 continue 277 ivtnum = 499 278c 279c **** test 499 **** 280c 281 if (iczero) 34990, 4990, 34990 282 4990 continue 283 ivcomp = 7151/3/10 284 go to 44990 28534990 ivdele = ivdele + 1 286 write (i02,80003) ivtnum 287 if (iczero) 44990, 5001, 44990 28844990 if (ivcomp - 238) 24990,14990,24990 28914990 ivpass = ivpass + 1 290 write (i02,80001) ivtnum 291 go to 5001 29224990 ivfail = ivfail + 1 293 ivcorr = 238 294 write (i02,80004) ivtnum, ivcomp ,ivcorr 295 5001 continue 296 ivtnum = 500 297c 298c **** test 500 **** 299c 300 if (iczero) 35000, 5000, 35000 301 5000 continue 302 ivcomp = 15248/51/13 303 go to 45000 30435000 ivdele = ivdele + 1 305 write (i02,80003) ivtnum 306 if (iczero) 45000, 5011, 45000 30745000 if (ivcomp - 22) 25000,15000,25000 30815000 ivpass = ivpass + 1 309 write (i02,80001) ivtnum 310 go to 5011 31125000 ivfail = ivfail + 1 312 ivcorr = 22 313 write (i02,80004) ivtnum, ivcomp ,ivcorr 314 5011 continue 315 ivtnum = 501 316c 317c **** test 501 **** 318c 319 if (iczero) 35010, 5010, 35010 320 5010 continue 321 ivcomp = 27342/4/3 322 go to 45010 32335010 ivdele = ivdele + 1 324 write (i02,80003) ivtnum 325 if (iczero) 45010, 5021, 45010 32645010 if (ivcomp - 2278) 25010,15010,25010 32715010 ivpass = ivpass + 1 328 write (i02,80001) ivtnum 329 go to 5021 33025010 ivfail = ivfail + 1 331 ivcorr = 2278 332 write (i02,80004) ivtnum, ivcomp ,ivcorr 333 5021 continue 334 ivtnum = 502 335c 336c **** test 502 **** 337c 338 if (iczero) 35020, 5020, 35020 339 5020 continue 340 ivcomp = 32767/2/1 341 go to 45020 34235020 ivdele = ivdele + 1 343 write (i02,80003) ivtnum 344 if (iczero) 45020, 5031, 45020 34545020 if (ivcomp - 16383) 25020,15020,25020 34615020 ivpass = ivpass + 1 347 write (i02,80001) ivtnum 348 go to 5031 34925020 ivfail = ivfail + 1 350 ivcorr = 16383 351 write (i02,80004) ivtnum, ivcomp ,ivcorr 352c 353c test 503 through test 507 - negative integer constants included 354c no truncation required 355c 356 5031 continue 357 ivtnum = 503 358c 359c **** test 503 **** 360c 361 if (iczero) 35030, 5030, 35030 362 5030 continue 363 ivcomp = -24/3/4 364 go to 45030 36535030 ivdele = ivdele + 1 366 write (i02,80003) ivtnum 367 if (iczero) 45030, 5041, 45030 36845030 if (ivcomp +2) 25030,15030,25030 36915030 ivpass = ivpass + 1 370 write (i02,80001) ivtnum 371 go to 5041 37225030 ivfail = ivfail + 1 373 ivcorr = -2 374 write (i02,80004) ivtnum, ivcomp ,ivcorr 375 5041 continue 376 ivtnum = 504 377c 378c **** test 504 **** 379c 380 if (iczero) 35040, 5040, 35040 381 5040 continue 382 ivcomp = 330/(-3)/2 383 go to 45040 38435040 ivdele = ivdele + 1 385 write (i02,80003) ivtnum 386 if (iczero) 45040, 5051, 45040 38745040 if (ivcomp + 55) 25040,15040,25040 38815040 ivpass = ivpass + 1 389 write (i02,80001) ivtnum 390 go to 5051 39125040 ivfail = ivfail + 1 392 ivcorr = -55 393 write (i02,80004) ivtnum, ivcomp ,ivcorr 394 5051 continue 395 ivtnum = 505 396c 397c **** test 505 **** 398c 399 if (iczero) 35050, 5050, 35050 400 5050 continue 401 ivcomp = 15249/(-13)/(-51) 402 go to 45050 40335050 ivdele = ivdele + 1 404 write (i02,80003) ivtnum 405 if (iczero) 45050, 5061, 45050 40645050 if (ivcomp - 23) 25050,15050,25050 40715050 ivpass = ivpass + 1 408 write (i02,80001) ivtnum 409 go to 5061 41025050 ivfail = ivfail + 1 411 ivcorr = 23 412 write (i02,80004) ivtnum, ivcomp ,ivcorr 413 5061 continue 414 ivtnum = 506 415c 416c **** test 506 **** 417c 418 if (iczero) 35060, 5060, 35060 419 5060 continue 420 ivcomp = -7150/(-2)/(-25) 421 go to 45060 42235060 ivdele = ivdele + 1 423 write (i02,80003) ivtnum 424 if (iczero) 45060, 5071, 45060 42545060 if (ivcomp + 143) 25060,15060,25060 42615060 ivpass = ivpass + 1 427 write (i02,80001) ivtnum 428 go to 5071 42925060 ivfail = ivfail + 1 430 ivcorr = -143 431 write (i02,80004) ivtnum, ivcomp ,ivcorr 432 5071 continue 433 ivtnum = 507 434c 435c **** test 507 **** 436c 437 if (iczero) 35070, 5070, 35070 438 5070 continue 439 ivcomp = (-32766)/(-2)/(-3) 440 go to 45070 44135070 ivdele = ivdele + 1 442 write (i02,80003) ivtnum 443 if (iczero) 45070, 5081, 45070 44445070 if (ivcomp + 5461) 25070,15070,25070 44515070 ivpass = ivpass + 1 446 write (i02,80001) ivtnum 447 go to 5081 44825070 ivfail = ivfail + 1 449 ivcorr = -5461 450 write (i02,80004) ivtnum, ivcomp ,ivcorr 451c 452c test 508 through test 513 - negative integer constants included 453c truncation required 454c 455 5081 continue 456 ivtnum = 508 457c 458c **** test 508 **** 459c 460 if (iczero) 35080, 5080, 35080 461 5080 continue 462 ivcomp = -24/3/3 463 go to 45080 46435080 ivdele = ivdele + 1 465 write (i02,80003) ivtnum 466 if (iczero) 45080, 5091, 45080 46745080 if (ivcomp + 2) 25080,15080,25080 46815080 ivpass = ivpass + 1 469 write (i02,80001) ivtnum 470 go to 5091 47125080 ivfail = ivfail + 1 472 ivcorr = -2 473 write (i02,80004) ivtnum, ivcomp ,ivcorr 474 5091 continue 475 ivtnum = 509 476c 477c **** test 509 **** 478c 479 if (iczero) 35090, 5090, 35090 480 5090 continue 481 ivcomp = 230/(-2)/3 482 go to 45090 48335090 ivdele = ivdele + 1 484 write (i02,80003) ivtnum 485 if (iczero) 45090, 5101, 45090 48645090 if (ivcomp + 38) 25090,15090,25090 48715090 ivpass = ivpass + 1 488 write (i02,80001) ivtnum 489 go to 5101 49025090 ivfail = ivfail + 1 491 ivcorr = -38 492 write (i02,80004) ivtnum, ivcomp ,ivcorr 493 5101 continue 494 ivtnum = 510 495c 496c **** test 510 **** 497c 498 if (iczero) 35100, 5100, 35100 499 5100 continue 500 ivcomp = 7151/(-3)/(-10) 501 go to 45100 50235100 ivdele = ivdele + 1 503 write (i02,80003) ivtnum 504 if (iczero) 45100, 5111, 45100 50545100 if (ivcomp - 238) 25100,15100,25100 50615100 ivpass = ivpass + 1 507 write (i02,80001) ivtnum 508 go to 5111 50925100 ivfail = ivfail + 1 510 ivcorr = 238 511 write (i02,80004) ivtnum, ivcomp ,ivcorr 512 5111 continue 513 ivtnum = 511 514c 515c **** test 511 **** 516c 517 if (iczero) 35110, 5110, 35110 518 5110 continue 519 ivcomp = -15248/(-51)/(-13) 520 go to 45110 52135110 ivdele = ivdele + 1 522 write (i02,80003) ivtnum 523 if (iczero) 45110, 5121, 45110 52445110 if (ivcomp + 22) 25110,15110,25110 52515110 ivpass = ivpass + 1 526 write (i02,80001) ivtnum 527 go to 5121 52825110 ivfail = ivfail + 1 529 ivcorr = -22 530 write (i02,80004) ivtnum, ivcomp ,ivcorr 531 5121 continue 532 ivtnum = 512 533c 534c **** test 512 **** 535c 536 if (iczero) 35120, 5120, 35120 537 5120 continue 538 ivcomp = (-27342)/(-4)/(-3) 539 go to 45120 54035120 ivdele = ivdele + 1 541 write (i02,80003) ivtnum 542 if (iczero) 45120, 5131, 45120 54345120 if (ivcomp + 2278) 25120,15120,25120 54415120 ivpass = ivpass + 1 545 write (i02,80001) ivtnum 546 go to 5131 54725120 ivfail = ivfail + 1 548 ivcorr = -2278 549 write (i02,80004) ivtnum, ivcomp ,ivcorr 550 5131 continue 551 ivtnum = 513 552c 553c **** test 513 **** 554c 555 if (iczero) 35130, 5130, 35130 556 5130 continue 557 ivcomp = 32767/2/(-1) 558 go to 45130 55935130 ivdele = ivdele + 1 560 write (i02,80003) ivtnum 561 if (iczero) 45130, 5141, 45130 56245130 if (ivcomp + 16383) 25130,15130,25130 56315130 ivpass = ivpass + 1 564 write (i02,80001) ivtnum 565 go to 5141 56625130 ivfail = ivfail + 1 567 ivcorr = -16383 568 write (i02,80004) ivtnum, ivcomp ,ivcorr 569c 570c test 514 through test 519 - positive and negative signed integer 571c constants in arithmetic expression. 572c 573 5141 continue 574 ivtnum = 514 575c 576c **** test 514 **** 577c 578 if (iczero) 35140, 5140, 35140 579 5140 continue 580 ivcomp = +24/(-3)/4 581 go to 45140 58235140 ivdele = ivdele + 1 583 write (i02,80003) ivtnum 584 if (iczero) 45140, 5151, 45140 58545140 if (ivcomp +2) 25140,15140,25140 58615140 ivpass = ivpass + 1 587 write (i02,80001) ivtnum 588 go to 5151 58925140 ivfail = ivfail + 1 590 ivcorr = -2 591 write (i02,80004) ivtnum, ivcomp ,ivcorr 592 5151 continue 593 ivtnum = 515 594c 595c **** test 515 **** 596c 597 if (iczero) 35150, 5150, 35150 598 5150 continue 599 ivcomp = 24/(+3)/(-4) 600 go to 45150 60135150 ivdele = ivdele + 1 602 write (i02,80003) ivtnum 603 if (iczero) 45150, 5161, 45150 60445150 if (ivcomp +2) 25150,15150,25150 60515150 ivpass = ivpass + 1 606 write (i02,80001) ivtnum 607 go to 5161 60825150 ivfail = ivfail + 1 609 ivcorr = -2 610 write (i02,80004) ivtnum, ivcomp ,ivcorr 611 5161 continue 612 ivtnum = 516 613c 614c **** test 516 **** 615c 616 if (iczero) 35160, 5160, 35160 617 5160 continue 618 ivcomp = -24/(-3)/(+4) 619 go to 45160 62035160 ivdele = ivdele + 1 621 write (i02,80003) ivtnum 622 if (iczero) 45160, 5171, 45160 62345160 if (ivcomp -2) 25160,15160,25160 62415160 ivpass = ivpass + 1 625 write (i02,80001) ivtnum 626 go to 5171 62725160 ivfail = ivfail + 1 628 ivcorr = 2 629 write (i02,80004) ivtnum, ivcomp ,ivcorr 630 5171 continue 631 ivtnum = 517 632c 633c **** test 517 **** 634c 635 if (iczero) 35170, 5170, 35170 636 5170 continue 637 ivcomp = -16811/(-16812)/(+1) 638 go to 45170 63935170 ivdele = ivdele + 1 640 write (i02,80003) ivtnum 641 if (iczero) 45170, 5181, 45170 64245170 if (ivcomp - 0) 25170,15170,25170 64315170 ivpass = ivpass + 1 644 write (i02,80001) ivtnum 645 go to 5181 64625170 ivfail = ivfail + 1 647 ivcorr = 0 648 write (i02,80004) ivtnum, ivcomp ,ivcorr 649 5181 continue 650 ivtnum = 518 651c 652c **** test 518 **** 653c 654 if (iczero) 35180, 5180, 35180 655 5180 continue 656 ivcomp = (-16811) / (+16811) / (+1) 657 go to 45180 65835180 ivdele = ivdele + 1 659 write (i02,80003) ivtnum 660 if (iczero) 45180, 5191, 45180 66145180 if (ivcomp +1) 25180,15180,25180 66215180 ivpass = ivpass + 1 663 write (i02,80001) ivtnum 664 go to 5191 66525180 ivfail = ivfail + 1 666 ivcorr = -1 667 write (i02,80004) ivtnum, ivcomp ,ivcorr 668 5191 continue 669 ivtnum = 519 670c 671c **** test 519 **** 672c 673 if (iczero) 35190, 5190, 35190 674 5190 continue 675 ivcomp = (-335)/(+168)/(+1) 676 go to 45190 67735190 ivdele = ivdele + 1 678 write (i02,80003) ivtnum 679 if (iczero) 45190, 5201, 45190 68045190 if (ivcomp + 1) 25190,15190,25190 68115190 ivpass = ivpass + 1 682 write (i02,80001) ivtnum 683 go to 5201 68425190 ivfail = ivfail + 1 685 ivcorr = -1 686 write (i02,80004) ivtnum, ivcomp ,ivcorr 687c **** end of tests **** 688 5201 continue 689c 690c write page footings and run summaries 69199999 continue 692 write (i02,90002) 693 write (i02,90006) 694 write (i02,90002) 695 write (i02,90002) 696 write (i02,90007) 697 write (i02,90002) 698 write (i02,90008) ivfail 699 write (i02,90009) ivpass 700 write (i02,90010) ivdele 701c 702c 703c terminate routine execution 704 stop 705c 706c format statements for page headers 70790000 format (1h1) 70890002 format (1h ) 70990001 format (1h ,10x,34hfortran compiler validation system) 71090003 format (1h ,21x,11hversion 1.0) 71190004 format (1h ,10x,38hfor official use only - copyright 1978) 71290005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect) 71390006 format (1h ,5x,46h----------------------------------------------) 71490011 format (1h ,18x,17hsubset level test) 715c 716c format statements for run summaries 71790008 format (1h ,15x,i5,19h errors encountered) 71890009 format (1h ,15x,i5,13h tests passed) 71990010 format (1h ,15x,i5,14h tests deleted) 720c 721c format statements for test results 72280001 format (1h ,4x,i5,7x,4hpass) 72380002 format (1h ,4x,i5,7x,4hfail) 72480003 format (1h ,4x,i5,7x,7hdeleted) 72580004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6) 72680005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5) 727c 72890007 format (1h ,20x,20hend of program fm037) 729 end 730