Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alignment Restrictions with equivalences

Status
Not open for further replies.

BPMan

Programmer
Jun 25, 2002
163
US
I am working with code that uses equivalences to make large common arrays.

I getting a error that reads like so:

Can't place `ifwicao' as directed by EQUIVALENCE due to alignment restrictions

And as far as i can tell everything lines up.
Does anyone know exactly why this happens and what is the general method for fixing it.

Can't post actual code.

thanks
 
Maybe you have mentioned both 'ifwicao' and the item you wish to equivalence it with, in a common statement (?)
 
As usually. you may calculate elements offsets off-hand. Take sizeof of integers (in the target platform - for example, on Intel 4 bytes, 4-byte boundaties), double precision (for example, 8 bytes, 8 bytes boundaries), characters (1..n bytes). Now check up where EQUIVALENCEs force boundaries. For example, you can't set by equivalence double precision variable to the 2nd element of an common block integer array (the var wants 8-byte boundary but 2nd element has 4 byte offset).
Data types boundaries are platform-specific values. Sometimes EQUIVALENCEs may raise very serious problems in legacy codes...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top