From: Steven G. Kargl Date: Thu, 25 Aug 2016 19:35:46 +0000 (+0000) Subject: re PR fortran/77351 (ICE in remove_trim, at frontend-passes.c:1145) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5cf162909e9209d20f3c33fc946d7f412f38028;p=gcc.git re PR fortran/77351 (ICE in remove_trim, at frontend-passes.c:1145) 2016-08-25 Steven g. Kargl PR fortran/77351 * frontend-passes.c (remove_trim,combine_array_constructor): Check for NULL pointer. 2016-08-25 Steven g. Kargl PR fortran/77351 * gfortran.dg/pr77351.f90: New test. From-SVN: r239763 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 93eb48ad52b..6def5b45ba2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-08-25 Steven g. Kargl + + PR fortran/77351 + * frontend-passes.c (remove_trim,combine_array_constructor): Check for + NULL pointer. + 2016-08-24 Paul Thomas PR fortran/77358 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 3892069d057..c138f4d7c77 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index caeaa7e5fe1..c39e1914efc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-25 Steven g. Kargl + + PR fortran/77351 + * gfortran.dg/pr77351.f90: New test. + 2016-08-25 Marek Polacek * c-c++-common/Wlogical-not-parentheses-2.c: New test. diff --git a/gcc/testsuite/gfortran.dg/pr77351.f90 b/gcc/testsuite/gfortran.dg/pr77351.f90 new file mode 100644 index 00000000000..76ce5c528b2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77351.f90 @@ -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" }