After a day looking at code in whatever is the current trendy language, I feel old. Fortran is old.
Fortran is about as old as what we now call computers. What we relative youngsters call modern computers and understand as programming would be completely unrecognizable to a Fortran pioneer.
Even on this site, you can see lots of questions about EQUIVALENCE and why it was used. You see many different questions and answers because it means one thing but can be used (abused in modern terms) to do many things.
Fortran 50 years ago didn't have many tools and those tools it had did a lot of work. Heck, 50 years ago Fortran didn't even have character data types and GO TO
was the go to for flow control.
Equivalence, as the question notes, is about having two things share the same part of memory: storage association.
What's the use of storage association? Several uses.
For example, know you have two variables or workspaces but aren't going to use both at the same time? Don't want to waste memory with them? Use the same memory.
Want to do tricks with data representation? Use the same lump of memory and call it two things.
Want to pass lots of model parameters to a subroutine? Use a huge argument list
function pmodel(x, y, z, p, t, dt)
pmodel = x+y+sqrt(z)*p*t/dt
end function
or pass an array and have something unreadable
function pmodel(pars)
pmodel = pars(1)+pars(2)+sqrt(pars(3))*pars(4)*pars(5)/pars(6)
end function
or use an array in common and equivalence them
function pmodel()
common pars
equivalence (pars(1), x), (pars(2), y) ... ! Like our question here
pmodel = x+y+sqrt(z)*p*t/dt
end function
We live in different, and far happier, times now. With data structures, more associations, cheap memory and a care for our fellow programmers.
So you could declare an int and a char and make the memory location they are stored at the same via an EQUIVALENCE statement.
This, however, is not true. Although a integer and a real, or a double precision and a complex, for example, can be equivalenced, characters are not allowed to be equivalenced with those non-character things. (That doesn't mean people didn't and that compilers stopped them from trying, but Fortran 77 onward strictly said you couldn't.)