diff options
Diffstat (limited to 'gcc/fortran/trans-array.cc')
-rw-r--r-- | gcc/fortran/trans-array.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 92e933a..8f76870 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -12123,8 +12123,11 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block) type = TREE_TYPE (descriptor); } - /* NULLIFY the data pointer, for non-saved allocatables. */ - if (GFC_DESCRIPTOR_TYPE_P (type) && !sym->attr.save && sym->attr.allocatable) + /* NULLIFY the data pointer for non-saved allocatables, or for non-saved + pointers when -fcheck=pointer is specified. */ + if (GFC_DESCRIPTOR_TYPE_P (type) && !sym->attr.save + && (sym->attr.allocatable + || (sym->attr.pointer && (gfc_option.rtcheck & GFC_RTCHECK_POINTER)))) { gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node); if (flag_coarray == GFC_FCOARRAY_LIB && sym->attr.codimension) |