From: Steven G. Kargl Date: Wed, 19 Jun 2019 17:58:54 +0000 (+0000) Subject: re PR fortran/87907 (ICE in resolve_contained_fntype, at fortran/resolve.c:587) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ee3aab6826f7dbfe0f1a509cb429f4a4d755f38b;p=gcc.git re PR fortran/87907 (ICE in resolve_contained_fntype, at fortran/resolve.c:587) 2019-06-19 Steven G. Kargl PR fortran/87907 * resolve.c (resolve_contained_fntype): Do not dereference a NULL pointer. 2019-06-19 Steven G. Kargl PR fortran/87907 * gfortran.dg/pr87907.f90: New testcase. From-SVN: r272480 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 289be5b6c81..62edba78f61 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-06-19 Steven G. Kargl + + PR fortran/87907 + * resolve.c (resolve_contained_fntype): Do not dereference a NULL + pointer. + 2019-06-19 Jim MacArthur Mark Eggleston diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index c565325ee2f..afa4e5c2ccf 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -583,6 +583,9 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns) || sym->attr.entry_master) return; + if (!sym->result) + return; + /* Try to find out of what the return type is. */ if (sym->result->ts.type == BT_UNKNOWN && sym->result->ts.interface == NULL) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4247335a6b1..aa41d2aac38 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-19 Steven G. Kargl + + PR fortran/87907 + * gfortran.dg/pr87907.f90: New testcase. + 2019-06-19 Wilco Dijkstra PR middle-end/84521 diff --git a/gcc/testsuite/gfortran.dg/pr87907.f90 b/gcc/testsuite/gfortran.dg/pr87907.f90 new file mode 100644 index 00000000000..0fe4e5090d2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr87907.f90 @@ -0,0 +1,23 @@ +! { dg-do compile } +! PR fortran/pr87907 +! Original testcase contributed by Gerhard Stienmetz +module m + interface + module function g(x) result(z) + integer, intent(in) :: x + integer, allocatable :: z + end + end interface +end + +submodule(m) m2 + contains + subroutine g(x) ! { dg-error "mismatch in argument" } + end +end + +program p + use m ! { dg-error "has a type" } + integer :: x = 3 + call g(x) ! { dg-error "which is not consistent with" } +end