1960's ICL FORTRAN
As a student in the late 70s I was learning FORTRAN and my program was giving strange results. Eventually I asked one of the postgrad assistants, who grinned. I wasn't the first one to make that particular error, it seems...
The opcodes on that ICL model (1906S) didn't allow for manipulating constants other than load & store, all other operations used memory addresses (no registers) so for speed the FORTRAN compiler put the common constants 0 to 19 into 20 consecutive addresses, and any time one was needed, the address of the location in question was used.
I had a subroutine which was taking its argument and adding 1 to it. I was calling it with a constant value "5". FORTRAN passes all arguments by reference (address), and whilst a modern compiler would place a constant argument in a scratch location & pass that location's address, the old compiler saved memory by just passing the address of the common constant.
When my subroutine was called, all the constant "5" values in the program got incremented...