Re: For old-timers: puzle of working bad programs



On 10/11/11 8:21 PM, Terence wrote:
I have two old CDC 1604 program that contain references to array variables
both with and without any indices; and in one case a double-indexed variable
used without any indices at all.

Also, there are clear instances of index boundaries being surpassed (e.g a
double-indexed array(2,15) where the larger maximum index of k=15 was in
fact used with k=1 to 99.

Yet the programs ares alledged to have produced a great number of reports
and plotted graphs. And I have got both running apart from one report having
numbers too low to be correct, so I assume the code still has bugs that
affect it if newly compiled, but not when used back in 1967,
.
Some such variable names were used without an index within a DO loop where
the index being cycled was the appropriate index for the variable;
I assumed that those were the indices to supply and those sections started
working correctly!

Other cases seem to those where the programmer did not know he already used
the same variable name before, in other circumstances of use.
Typical were R for a radius of anything and D, any distance. Yet both were
used as arrays, as well as non-indexed temporary variables.

My question is:

Does any old-timer remember what the (badly-checking compiler) CDC default
action was? I seem to remember that array(1,1) was the address passed in
subroutines, but what happened when missing in in-line code?



Being less than 70, I'm not an old timer!!!

But, as I recall the CDC 1604 compilers of that era would evaluate an array reference of the form
A(I,J,K...)
as
@A + I-1 + dim1*(J-1) + dim1*dim2*(K-1)...

So long as the I,J,K... series was shorter than the rank of the array things were OK. Whatever was there was what was there and the equation was evaluated. It was all known at compile time (obviously). If one or more subscripts were missing it was OK, the trailing terms in the subscript equation were omitted. The only requirement was that the final address value was "in bounds."

And even that was a fairly loose one. It was possible (I almost said "reasonable") to do something like
dimension A(1)
k = loc(A)
A(I-k) = whatever
to assign the value "whatever" to absolute memory address I (or maybe I-1). Non-standard, but what the heck.

The standards are forgiving on what happens when array arguments are passed to subroutines. In particular, storage association allows arrays to be reshaped across CALLs. It's ambiguous on the CALL side whether A(1,1) is an array or a scalar on the CALLed side. And, if it's an array, it can be of any rank. The only (usually unenforced) rule is that the size on the CALLed side can't exceed the size on the CALL side. This is still essentially what the standard allows.

My recollection is that neither the official CDC nor the superior University of Minnesota compiler allowed unsubscripted arrays to be used in expressions. The only exectuional use was as in an I/O list or as an actual argument (and it wasn't checked whether A or A(1,1) was what was intended).

I can sympathize with your problems; back in the good old days we didn't have seat belts or ABS systems.

Dick Hendrickson




.



Relevant Pages

  • Re: Idea for ECMA/C# Standard - compile time hash for performance
    ... I agree with you the chance of a compiler change is slim, ... and then delegating to the standard hash for fields accessed less frequently. ... or the array lookup which would require the ... > 64-bit architecture) for each enum value that doesn't map to anything. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Windows array allocation problem
    ... array reference has to have a 64-bit index or array subscript triplet? ... to fit in one. ... That assumes, of course, that your compiler ... limits on just about anything. ...
    (comp.lang.fortran)
  • Re: Q: Checking the size of a non-allocated array?
    ... an actual argument is already invalid ... First note that you don't have an unallocated array in the subroutine. ... it is comparable to disassociated or undefined pointers. ... Obviously the compiler has ...
    (comp.lang.fortran)
  • Re: Moving from 8051 to AVR
    ... particular task -- all of which adhear to the standards. ... incrementing a pointer through an array. ... If the compiler can figure out what is happening, ... An architecture which is C-Friendly will simplify writing the compiler ...
    (comp.arch.embedded)
  • Re: Is this expected behavior or not
    ... This gives you array interfaces while keeping arrays ... to know the representation in order to be able to pass it meaningfully. ... not a normal array if you are using the character interface). ... should have a tag and it's up to the compiler how to implement it. ...
    (comp.lang.ada)