I have discovered a problem with TYPEs in FTN95 version 7.10. In the following code,
TYPE NOTSOGOOD
CHARACTER*2 CHARS
INTEGER*4 NUMBER
END TYPE NOTSOGOOD
TYPE (NOTSOGOOD) NSG(50)
when one references NSG(1)%CHARS, for example, it pick up 4 bytes: CHARS and the 2 low-order bytes of NUMBER. NSG(1)%NUMBER will contain the high-order bytes in the low-order position and NSG(2)%CHARS in the high-order bytes. NSG(2)%CHARS will contain the entire NSG(2)%NUMBER, and so on.
If I 'constrain' the array with the following equivalent code:
TYPE THISWORKS
UNION
MAP
CHARACTER*6 NOTUSED
END MAP
MAP
CHARACTER*2 CHARS
INTEGER*4 NUMBER
END MAP
END UNION
TYPE (THISWORKS) TW(50)
memory is allocated and referenced correctly. There is no problem with TYPEs that contain only numeric or only character fields. They can be mixed, INTEGER*2 and REAL, for example. It's been awhile since I've looked at the forum or made a post so has anyone else discovered this or is it fixed in 7.20?