https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86277
--- Comment #24 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #23)
>
> This regresses on pr108065.f90 (that's a few extra analyzer warnings),
> and on pr69955.f90 (that's one extra __builtin_malloc).
This removes the regressions. Not fully retested again.
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 1c7ea900ea1..7ae7eacca0b 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 || (dynamic && integer_zerop (size)))
{
/* A callee allocated array. */
gfc_conv_descriptor_data_set (pre, desc, null_pointer_node);