* [Committed] PR fortran/77351
@ 2016-08-25 19:37 Steve Kargl
0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2016-08-25 19:37 UTC (permalink / raw)
To: fortran, gcc-patches
I've committed the following patch. tkoenig approved it
in bugzilla.
2016-08-25 Steven g. Kargl <kargl@gcc.gnu.org>
PR fortran/77351
* frontend-passes.c (remove_trim,combine_array_constructor): Check for
NULL pointer.
2016-08-25 Steven g. Kargl <kargl@gcc.gnu.org>
PR fortran/77351
* gfortran.dg/pr77351.f90: New test.
Index: gcc/fortran/frontend-passes.c
===================================================================
--- gcc/fortran/frontend-passes.c (revision 239762)
+++ gcc/fortran/frontend-passes.c (working copy)
@@ -1137,6 +1137,8 @@ remove_trim (gfc_expr *rhs)
bool ret;
ret = false;
+ if (!rhs)
+ return ret;
/* Check for a // b // trim(c). Looping is probably not
necessary because the parser usually generates
@@ -1274,6 +1276,9 @@ combine_array_constructor (gfc_expr *e)
op1 = e->value.op.op1;
op2 = e->value.op.op2;
+ if (!op1 || !op2)
+ return false;
+
if (op1->expr_type == EXPR_ARRAY && op2->rank == 0)
scalar_first = false;
else if (op2->expr_type == EXPR_ARRAY && op1->rank == 0)
Index: gcc/testsuite/gfortran.dg/pr77351.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77351.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77351.f90 (working copy)
@@ -0,0 +1,6 @@
+! { dg-do compile }
+program p
+ integer :: z(4) = [1, 2, 3, 4]
+ print *, any(shape(z) /= [4,1]) ! { dg-error "shape for elemental binary" }
+end
+! { dg-excess-errors "operands are incommensurate" }
--
Steve
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-25 19:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25 19:37 [Committed] PR fortran/77351 Steve Kargl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).