https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67679
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- This patch Index: trans-array.c =================================================================== --- trans-array.c (Revision 268432) +++ trans-array.c (Arbeitskopie) @@ -5960,19 +5960,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, } set_descriptor = gfc_finish_block (&set_descriptor_block); - if (status != NULL_TREE) - { - cond = fold_build2_loc (input_location, EQ_EXPR, - logical_type_node, status, - build_int_cst (TREE_TYPE (status), 0)); - gfc_add_expr_to_block (&se->pre, - fold_build3_loc (input_location, COND_EXPR, void_type_node, - cond, - set_descriptor, - build_empty_stmt (input_location))); - } - else - gfc_add_expr_to_block (&se->pre, set_descriptor); + gfc_add_expr_to_block (&se->pre, set_descriptor); return true; } gets rid of the undefined warnings, but it would also change the array bounds after a failed allocation. Not sure if this is standard conforming (see PR 49755).