Mixed Equivalence
Equivalence of Variables of Different Types or Kinds
| SimCon Home | fpt Reference Manual Home |
Why is Mixed Equivalence a Problem?
Mixed equivalence occurs when objects of different data types or kinds occupy the same memory locations. It may be caused by different mappings of the same COMMON block in different routines, and may then be accidental. It may be created deliberately by the use of (Now obsolescent) EQUIVALENCE statements.
Accidental mixed equivalence is likely to cause problems because objects may be overwritten or transferred at the wrong addresses. This is discussed in the Accidental Equivalence page in the legacy section below. Deliberate mixed equivalence may also cause problems in migration between systems.
The fpt Report
The fpt command is:
fpt checks for mixed equivalence and for implied equivalence. Implied equivalence occurs when different objects are mapped to the same COMMON block locations in different sub-programs. A report of mixed equivalence in local variables in a control code for a tracking radar is shown below:
******************** r_h_el sr_uppol Local REAL *4 (1:2) equ_h_el sr_uppol Local COMPLEX *8 ******************** sample sr4caliq Local COMPLEX *8 samp_equ sr4caliq Local REAL *4 (1:2) ******************** secs_2 artm_b2r Local INTEGER *2 (1:2) secs artm_b2r Local INTEGER *4 ******************** secs_2 artm_r2b Local INTEGER *2 (1:2) secs artm_r2b Local INTEGER *4 ******************** selword rsel_to_r4 Local INTEGER *1 (0:3) itemp rsel_to_r4 Local INTEGER *4 ********************
The mapping of two 4-byte real variables to one 8-byte complex variable did not cause a problem. The mapping of an INTEGER*1 array to an INTEGER*4, and of an INTEGER*2 array to an INTEGER*4 caused a systematic problem in migrating the tracking radar code from a big-ended Gould-SEL machine to a PC. The mapping was used for word and bit manipulation and all of the code affected had to be revised.
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.