I understand that two variables, say a1 and a2 appear in Equivalence(a1,a2) statement in Fortran, then they occupy the same memory space. So say this happens in a procedure where both a1 and a2 are local variables in that procedure.
This means that you can't only have a copy of a1 and a2 in memory right? Because one of the values will be overwritten. You could keep a1 in the memory location and keep a2 in a register for the whole of the procedure and this will be fine right?
My question is basically: Can you keep a1 in a register for the whole procedure?
I would say yes...unless you run out of registers and a1 has to be stored back to memory. Then you will overwrite a2 and lose it's value, and both variables a1 and a2 will then actually point to the value of a1.