aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/frontend-passes.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2016-08-25 19:35:46 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2016-08-25 19:35:46 +0000
commite5cf162909e9209d20f3c33fc946d7f412f38028 (patch)
tree5ffb23da2ec76df0438906ebb898db781a219154 /gcc/fortran/frontend-passes.c
parent384043e89efc6f0898b3bab3a758c3b55d3f2bcb (diff)
downloadgcc-e5cf162909e9209d20f3c33fc946d7f412f38028.zip
gcc-e5cf162909e9209d20f3c33fc946d7f412f38028.tar.gz
gcc-e5cf162909e9209d20f3c33fc946d7f412f38028.tar.bz2
re PR fortran/77351 (ICE in remove_trim, at frontend-passes.c:1145)
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. From-SVN: r239763
Diffstat (limited to 'gcc/fortran/frontend-passes.c')
-rw-r--r--gcc/fortran/frontend-passes.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 3892069..c138f4d 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)