#581: Pass unallocated arrays to Fortran as NULL pointers -------------------------+-------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: new Priority: major | Milestone: Component: Cactus | Version: Keywords: | -------------------------+-------------------------------------------------- The deleted comment is wrong. We should always pass unallocated arrays to Fortran to catch allocation errors.
#581: Pass unallocated arrays to Fortran as NULL pointers --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: review Priority: major | Milestone: Component: Cactus | Version: Resolution: | Keywords: --------------------------+------------------------------------------------- Changes (by eschnett):
* status: new => review
#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.
#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 knarf):
Erik: did you change your mind and don't want to apply it?
#581: Pass unallocated arrays to Fortran as NULL pointers --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: closed Priority: major | Milestone: Component: Cactus | Version: Resolution: fixed | Keywords: --------------------------+------------------------------------------------- Changes (by eschnett):
* status: review => closed * resolution: => fixed
Comment:
I did not change my mind -- I only did not want to apply this shortly before the release.
Applied.
trac@lists.einsteintoolkit.org