https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99349
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #1) > Tested against original code. Not regression tested. Steve, your patch appears to regtest ok. However, from a error recovery point of view, I wonder if this modification is the right way to go. Since you authored the code segment in question, you might know better than me what is intended. Running the testcase under the debugger, I find (*result)->ts.type to be of type BT_LOGICAL, which is a consequence of the bad decl of a. (There is no parameter inquiry that returns a logical.) The return value match_data_constant would then be MATCH_YES, even if an error occurred. Alternatively, simply catching the NULL pointer dereference by diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index b6400514731..0f9b2ced4c2 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -423,7 +423,8 @@ match_data_constant (gfc_expr **result) 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); also fixes the ICE. It's basically that the error message generated differs from the one I get with your patch. Do you have additional thoughts?