diff mbox

[Committed] PR fortran/77694

Message ID 20160925173301.GA76338@troutmask.apl.washington.edu
State New
Headers show

Commit Message

Steve Kargl Sept. 25, 2016, 5:33 p.m. UTC
Committed as "obvious" even though thomas OK patch
in bugzilla audit trail.

2016-09-25  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77694
	* frontend-passes.c (optimize_binop_array_assignment): Check pointer
	for NULL.

2016-09-25  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77694
	* gfortran.dg/pr77694.f90: New test.
diff mbox

Patch

Index: gcc/fortran/frontend-passes.c
===================================================================
--- gcc/fortran/frontend-passes.c	(revision 240383)
+++ gcc/fortran/frontend-passes.c	(working copy)
@@ -1076,6 +1076,9 @@  optimize_binop_array_assignment (gfc_cod
 {
   gfc_expr *e;
 
+  if (!*rhs)
+    return false;
+
   e = *rhs;
   if (e->expr_type == EXPR_OP)
     {
Index: gcc/testsuite/gfortran.dg/pr77694.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77694.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77694.f90	(working copy)
@@ -0,0 +1,7 @@ 
+! { dg-do compile }
+! { dg-options -O }
+program p
+   logical x(2), y(2)
+   x = .true.
+   y = .nt. x   ! { dg-error "Unknown operator" }
+end