https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86059
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P4 Status|UNCONFIRMED |NEW Last reconfirmed| |2018-06-07 CC| |kargl at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |kargl at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from kargl at gcc dot gnu.org --- I have a patch for this, but I need to spend time with the standard because I cannot find a prohibition against NULL() in an array constructor (although it makes absolutely no sense to allow it). Watch for cut-n-paste tab corruption Index: array.c =================================================================== --- array.c (revision 261285) +++ array.c (working copy) @@ -1098,6 +1098,16 @@ match_array_cons_element (gfc_constructor_base *result if (m != MATCH_YES) return m; + if (expr->expr_type == EXPR_FUNCTION + && expr->ts.type == BT_UNKNOWN + && strcmp(expr->symtree->name, "null") == 0) + { + gfc_error ("NULL() at %L cannot appear in an array constructor", + &expr->where); + gfc_free_expr (expr); + return MATCH_ERROR; + } + gfc_constructor_append_expr (result, expr, &gfc_current_locus); return MATCH_YES; } gfcx -c ~/tmp/a.f90 /safe/sgk/tmp/a.f90:2:32: integer :: i(2) = [integer :: null(), 1] 1 Error: NULL() at (1) cannot appear in an array construct /safe/sgk/tmp/a.f90:3:24: integer :: j(2) = [1, null()] 1 Error: NULL() at (1) cannot appear in an array construct /safe/sgk/tmp/a.f90:4:23: integer :: k(2) = [(null(), n=1, 2)] 1 Error: NULL() at (1) cannot appear in an array construct