Reply to post: Not just assembly.

Can your rival fix it as fast? turns out to be ten-million-dollar question for plucky support guy

Phil O'Sophical Silver badge

Not just assembly.

Late 70's, ICL 1900 FORTRAN, I was an undergrad student just learning the language, and had a program that just behaved bizarrely, loops that ran for the wrong number of times and similar weird things.

Turned out that 1900-series systems had no machine-level instructions to add a constant to a location, you had to put the constant into another storage location and then add the two contents together. As an optimisation the compiler stored the numbers 1-10 (or maybe 20, I forget) in a fixed table so that they could be quickly accessed.

I was calling a subroutine with a constant argument, and inside that subroutine I was inadventently changing it. FORTRAN passes all arguments by reference (i.e. pointers) and there was no form of readonly page protection on those systems, so my when I inadvertently added 1 to the passed-in constant 5, all "constant" 5s in the program became 6s...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon