Controlling allocation in 64-bit space
We're looking to do what would be called 'a dodgy hack'.
We have some Fortran code that puts arrays of size 1 into the .text section of a
binary, These arrays will have 64-bit addresses. We then want to allocate a
section of memory using a C function that returns an offset from our array
address as a 4-byte uint (Fortran 77 has no pointers). We can then access
ARRAY(offset + 54) which equates to &ARRAY + offset + 54 bytes. In effect it is
a giant buffer overrun, but this is apparently the established way to do memory
allocation in Fortran.
The ultimate solution will be to #define a POINTER type that is the correct size
for the architecture, unfortunately there is an awful lot of code to fix.
What we want to do is be able to allocate a region of memory that has an offset
that is within 4-bytes of &ARRAY, but this goes beyond my knowledge of the
allocator, that I'm not even sure where to start looking.
Any help would be much appreciated.
Regards,
--davyd
PS. please CC replies, am off list
--
Davyd Madeley Software Engineer
Fugro Seismic Imaging, Perth Australia
Reply to: