[ET Trac] [Einstein Toolkit] #581: Pass unallocated arrays to Fortran as NULL pointers
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Wed Sep 28 20:27:58 CDT 2011
#581: Pass unallocated arrays to Fortran as NULL pointers
--------------------------+-------------------------------------------------
Reporter: eschnett | Owner:
Type: enhancement | Status: review
Priority: major | Milestone:
Component: Cactus | Version:
Resolution: | Keywords:
--------------------------+-------------------------------------------------
Comment (by rhaas):
while I think I can definitely construct a situation where a compiler is
perfectly correct in trying to access the NULL pointer, namely something
like:
{{{
CCTK_REAL gxx(cctk_lsh(1), cctk_lsh(2), cctk_lsh(3))
CCTK_REAL betax(cctk_lsh(1), cctk_lsh(2), cctk_lsh(3))
...
gxxL = gxx(i,j,k)
if(shift_state.ne.0) then
bx = betax(i,j,k)
else
bx = 0.0
endif
}}}
I think that unless we actually know of a compiler that gives segfaults in
this case I would think that the benefit of having unallocated grid
functions detected in Fortran outweights the undocumented behaviour we
exploit here (plus we are already using undocumented/compiler-specific
features when calling Fortran code from C).
I compiles for me and seems to not crash the testsuites (gcc 4.6). Please
apply.
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/581#comment:2>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list