+2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/67614
+ * resolve.c (gfc_resolve_code): Prevent ICE for invalid EXPR_NULL.
+
2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67525
{
gfc_expr *e = code->expr1;
+ gfc_resolve_expr (e);
+ if (e->expr_type == EXPR_NULL)
+ gfc_error ("Invalid NULL at %L", &e->where);
+
if (t && (e->rank > 0
|| !(e->ts.type == BT_REAL || e->ts.type == BT_INTEGER)))
gfc_error ("Arithmetic IF statement at %L requires a scalar "
- "REAL or INTEGER expression", &code->expr1->where);
+ "REAL or INTEGER expression", &e->where);
resolve_branch (code->label1, code);
resolve_branch (code->label2, code);
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+! PR fortran/67614
+!
+program foo
+ implicit none
+ integer, pointer :: z
+ if (null(z)) 10, 20, 30 ! { dg-error "Invalid NULL" }
+10 continue
+20 continue
+30 continue
+end program foo