gcc/fortran/ChangeLog:
PR fortran/99349
* decl.cc (match_data_constant): Avoid NULL pointer dereference.
gcc/testsuite/ChangeLog:
PR fortran/99349
* gfortran.dg/pr99349.f90: New test.
Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
data-pointer-initialization compatible (7.5.4.6) with the initial
data target; the data statement object is initially associated
with the target. */
- if ((*result)->symtree->n.sym->attr.save
+ if ((*result)->symtree
+ && (*result)->symtree->n.sym->attr.save
&& (*result)->symtree->n.sym->attr.target)
return m;
gfc_free_expr (*result);
--- /dev/null
+! { dg-do compile }
+! PR fortran/99349 - ICE in match_data_constant
+! Contributed by G.Steinmetz
+
+function f()
+ logical, parameter :: a((1.)/0) = .true. ! { dg-error "Parameter array" }
+ integer :: b
+ data b /a%kind/ ! { dg-error "Syntax error" }
+end