13

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) end 

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.

Update: Another bug observed in the compiler is that the program

 dimension ia(9,9) do 1 i=1,9 do 1 j=1,9 1 ia(i,j)=10*i+j e=2.718281828 pi=3.14159265 i=ia(e,pi) j=ia(pi,e) print 2,i,j 2 format(2i6) end 

prints 33 92, instead of erroring out or printing 23 32.

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

2
  • 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.CommentedMar 10, 2017 at 19:28
  • @John True, but the code could have stemmed from the same parser table if written by the same people.
    – Leo B.
    CommentedMar 11, 2017 at 0:50

1 Answer 1

2

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.

4
  • 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.
    CommentedJan 26, 2017 at 4:32
  • This should have been written as a comment.
    – Leo B.
    CommentedJan 26, 2017 at 4:35
  • What's the bug supposed to be, that it doesn't flag the incorrect IF statement?CommentedMar 11, 2017 at 8:06
  • @JohnR.Strohm Yes. Another FORTRAN compiler says ` ERROR 101 IN 00004 ILLEGAL TYPE OF IF EXPRESSION`
    – Leo B.
    CommentedJun 23, 2017 at 20:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.