https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86277

--- Comment #22 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to anlauf from comment #20)
> (In reply to Mikael Morin from comment #18)
> > Created attachment 55300 [details]
> > Alternative patch v2
> 
> This patch fails for me on several occasions including the testsuite.

Obviously the stack shouldn't be used if the array can grow dynamically
(dynamic == true).
So the patch could be simplified further:

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 1c7ea900ea1..cc1dddbeb33 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -1117,7 +1117,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre,
stmtblock_t * post,

   desc = info->descriptor;
   info->offset = gfc_index_zero_node;
-  if (size == NULL_TREE || integer_zerop (size))
+  if (size == NULL_TREE)
     {
       /* A callee allocated array.  */
       gfc_conv_descriptor_data_set (pre, desc, null_pointer_node);

Reply via email to