- changed status to open
- removed comment
Pass unallocated arrays to Fortran as NULL pointers
The deleted comment is wrong. We should always pass unallocated arrays to Fortran to catch allocation errors.
Keyword:
Comments (5)
-
reporter -
- removed comment
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.
-
- removed comment
Erik: did you change your mind and don't want to apply it?
-
reporter - changed status to resolved
- removed comment
I did not change my mind -- I only did not want to apply this shortly before the release.
Applied.
-
- changed status to closed
- edited description
- Log in to comment