From ac80378f4a966aa6b5490cf087380c7324681997 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Sun, 4 Mar 2018 01:37:13 +0000 Subject: [PATCH] re PR fortran/71085 (ICE with some intrinsic functions specifying array function result dimension) 2018-03-03 Harald Anlauf PR fortran/71085 * trans-expr.c (gfc_apply_interface_mapping_to_expr): Do not dereference NULL pointer. 2018-03-03 Harald Anlauf PR fortran/71085 * gfortran.dg/pr71085.f90: New test. From-SVN: r258228 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-expr.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr71085.f90 | 12 ++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr71085.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index eb64c7452f1..9a5b5670b02 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-03-03 Harald Anlauf + + PR fortran/71085 + * trans-expr.c (gfc_apply_interface_mapping_to_expr): Do not + dereference NULL pointer. + 2018-03-03 Steven G. Kargl PR fortran/66128 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index a93257c73bf..c84cd107370 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -4349,6 +4349,8 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping, if (expr->value.function.esym == NULL && expr->value.function.isym != NULL + && expr->value.function.actual + && expr->value.function.actual->expr && expr->value.function.actual->expr->symtree && gfc_map_intrinsic_function (expr, mapping)) break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45b72e5037f..63adcbe988e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-03 Harald Anlauf + + PR fortran/71085 + * gfortran.dg/pr71085.f90: New test. + 2018-03-03 Steven G. Kargl PR fortran/66128 diff --git a/gcc/testsuite/gfortran.dg/pr71085.f90 b/gcc/testsuite/gfortran.dg/pr71085.f90 new file mode 100644 index 00000000000..11d9850fb90 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71085.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR 71085 +! +! Testcase from PR by Vladimir Fuka +! +program pr71085 + print *, f() +contains + function f() + integer :: f(iargc()*10) + end +end -- 2.30.2