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

--- Comment #3 from anlauf at gcc dot gnu.org ---
The obvious patch

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index ac1f63f66e0..f38def4c291 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -728,7 +728,7 @@ gfc_match_data (void)
          gfc_constructor *c;
          c = gfc_constructor_first (new_data->value->expr->value.constructor);
          for (; c; c = gfc_constructor_next (c))
-           if (c->expr->ts.type == BT_BOZ)
+           if (c->expr && c->expr->ts.type == BT_BOZ)
              {
                gfc_error ("BOZ literal constant at %L cannot appear in a "
                           "structure constructor", &c->expr->where);

leads to:

z1.f90:5:19:

    5 |       data c /t(1)/
      |                   1
Error: Unexpected DATA statement at (1)

Reply via email to