Commit 2d2de608 by Steven G. Kargl

re PR fortran/67614 (ICE on using arithmetic if with null)

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/67614
	* gfortran.dg/pr67614.f90: New test.

From-SVN: r228156
parent b15e7bdd
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
* parse.c (match_deferred_characteristics): Remove an assert, which
allows an invalid SELECT TYPE selector to be detected.
......
......@@ -10380,10 +10380,14 @@ gfc_resolve_code (gfc_code *code, gfc_namespace *ns)
{
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);
......
2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67614
* gfortran.dg/pr67614.f90: New test.
2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67525
* gfortran.dg/pr67525.f90: New test.
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment