re PR fortran/77694 (ICE in optimize_binop_array_assignment, at fortran/frontend...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 25 Sep 2016 17:30:27 +0000 (17:30 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 25 Sep 2016 17:30:27 +0000 (17:30 +0000)
2016-09-22  Steven G. Kargl  <kargl@gcc.gnu.org>

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

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

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

From-SVN: r240476

gcc/fortran/ChangeLog
gcc/fortran/frontend-passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr77694.f90 [new file with mode: 0644]

index fbab438a959cf069812248df76759e326ad3b9f4..96867e386d68ecb09750f1edc5fb9367873edd5e 100644 (file)
@@ -1,3 +1,9 @@
+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-23  Fritz Reese  <fritzoreese@gmail.com>
 
        * lang.opt, invoke.texi, gfortran.texi: New flag -fdec-static.
index cd1097910751e924f3b19f464c8c879a0ea9463d..3a2c16e522695af7e20357eadf6ac379e4721ca8 100644 (file)
@@ -1076,6 +1076,9 @@ optimize_binop_array_assignment (gfc_code *c, gfc_expr **rhs, bool seen_op)
 {
   gfc_expr *e;
 
+  if (!*rhs)
+    return false;
+
   e = *rhs;
   if (e->expr_type == EXPR_OP)
     {
index 4fc22c4e65f1362f59a671da763d9a50053d9421..5f7435ee8977e9b0b5cb944babd08cd7c23ce783 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-25  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/77694
+       * gfortran.dg/pr77694.f90: New test.
+
 2016-09-25  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/51244
diff --git a/gcc/testsuite/gfortran.dg/pr77694.f90 b/gcc/testsuite/gfortran.dg/pr77694.f90
new file mode 100644 (file)
index 0000000..d9dc01b
--- /dev/null
@@ -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