The first FORTRAN compiler for the Soviet BESM-6 mainframe was written by means of manually retargeting the assembly code of the CDC 1604 FORTRAN compiler donated by CERN to JINR.

As a result is it likely that any bug in the front-end of the BESM-6 compiler replicates a bug in the original CDC 1604 code. There is a peculiar bug: select "FORTRAN bug" in the left column, then press RUN.

      program main
      i = 5
      j = 5
      if (i=j) print 10
   10 format(13hHello, world!)
      print 20
   20 format(32hWhy isn't "hello, world" printed)

Unfortunately, SIMH doesn't have the CDC 1604 among the emulated systems, and even if it did, I wouldn't know where to find a FORTRAN compiler for it. I could have tried the CDC 1700, but I don't see a mention of the compiler here, only the runtime.

I'd like to check if the bug exists in the original code. Does a CDC 1604 emulator exist with a functional FORTRAN compiler?

  • The CDC 1604 was a 48-bit machine, the forerunner of the 3x00 series. The CDC 1700 was, essentialy, a 16-bit minicomputer. Completely different architecture. – John R. Strohm Mar 10 '17 at 19:28
  • @John True, but the code could have stemmed from the same parser table if written by the same people. – Leo B. Mar 11 '17 at 0:50

The obvious reason why "Hello World" isn't printed is that

if (i=j) print 10

is not standard Fortran in any dialect I have ever seen in 40+ years of Fortran programming. Even in Fortran 90 and later, the relational operator for equality is == not =.

If there is a "bug", probably it is the fact that the compiler didn't print an error message, or your emulator has lost the error output somewhere. The compiler then generated no code for the statement containing the error, and you executed the program with that statement deleted.

if (i .eq. j) print 10

is standard Fortran, and works as expected.

| improve this answer | |
  • That's exactly right. Moreover, the generated code is as if, instead of "if (i=j) print 10" there was "i = j" and "if (0.ne.0) print 10" – Leo B. Jan 26 '17 at 4:32
  • This should have been written as a comment. – Leo B. Jan 26 '17 at 4:35
  • What's the bug supposed to be, that it doesn't flag the incorrect IF statement? – John R. Strohm Mar 11 '17 at 8:06
  • @JohnR.Strohm Yes. Another FORTRAN compiler says ` ERROR 101 IN 00004 ILLEGAL TYPE OF IF EXPRESSION` – Leo B. Jun 23 '17 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.