[gfortran] Nullify deallocated pointers.
Paul Brook
paul@nowt.org
Sat Nov 29 15:05:00 GMT 2003
Patch below ensures pointers are nullified after deallocation.
Tested on i686-linux.
Applied to tree-ssa branch.
Paul
2003-11-29 Paul Brook <paul@nowt.org>
* runtime/memory.c (deallocate): Nullify pointer after freeing.
testsuite
* gfortran.fortran-torture/execute/allocate.f90: New test.
--- clean/tree-ssa/libgfortran/runtime/memory.c
+++ gcc/libgfortran/runtime/memory.c
@@ -340,6 +340,7 @@ deallocate (void **mem, GFC_INTEGER_4 *
/* Just use the internal routine. */
internal_free (*mem);
+ *mem = NULL;
if (stat)
*stat = 0;
More information about the Gcc-patches
mailing list