Message ID | 908103EDB4893A42920B21D3568BFD9315105D12@MBX13.d.ethz.ch |
---|---|
State | New |
Headers | show |
> thanks for your good question. I think it is equivalent, as it seems that GFC_DESCRIPTOR_TYPE_P (type) implies either sym->attr.allocatable or sym->attr.pointer. To check, I rank a check-fortran with the explicit patch below, and this made no difference. Code gen for a number of additional testcases involving alloc_comp and finalizers looked good as well. So, I think the original patch is still fine.
OK to commit, then. Thanks for the thorough answer to my question.
FX
Index: trans-array.c =================================================================== --- trans-array.c (revision 215373) +++ trans-array.c (working copy) @@ -8647,9 +8647,18 @@ gfc_trans_deferred_array (gfc_symbol * s type = TREE_TYPE (descriptor); } - /* NULLIFY the data pointer. */ + /* NULLIFY the data pointer, for non-saved allocatables. */ if (GFC_DESCRIPTOR_TYPE_P (type) && !sym->attr.save) - gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node); + { + if (sym->attr.allocatable) + { + gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node); + } + else + { + if (!sym->attr.pointer) gcc_unreachable (); + } + } gfc_restore_backend_locus (&loc); gfc_init_block (&cleanup);