From: Thomas Koenig Date: Wed, 21 Mar 2018 21:12:41 +0000 (+0000) Subject: re PR fortran/84957 (ICE in gfc_sym_type, at fortran/trans-types.c:2255) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=482768bd6b85a5e7b7cf8a208e8a9c50bda052e1;p=gcc.git re PR fortran/84957 (ICE in gfc_sym_type, at fortran/trans-types.c:2255) 2018-03-21 Thomas Koenig Harald Anlauf PR fortran/84957 * trans-types.c (gfc_sym_type): Do not dereference NULL pointer. 2018-03-21 Thomas Koenig Harald Anlauf PR fortran/84957 * gfortran.dg/pr84957.f90: New test. Co-Authored-By: Harald Anlauf From-SVN: r258745 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b69b559cae7..87c78ebdc15 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-03-21 Thomas Koenig + Harald Anlauf + + PR fortran/84957 + * trans-types.c (gfc_sym_type): Do not dereference NULL pointer. + 2018-03-21 Janne Blomqvist PR fortran/84615 diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 20de203e607..7ff27a3650c 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2252,6 +2252,7 @@ gfc_sym_type (gfc_symbol * sym) && sym->ts.type == BT_CHARACTER && sym->ts.u.cl->backend_decl == NULL_TREE && sym->ns->proc_name + && sym->ns->proc_name->ts.u.cl && sym->ns->proc_name->ts.u.cl->backend_decl != NULL_TREE) sym->ts.u.cl->backend_decl = sym->ns->proc_name->ts.u.cl->backend_decl; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index faf418dd1b1..cc81884b4f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-03-21 Thomas Koenig + Harald Anlauf + + PR fortran/84957 + * gfortran.dg/pr84957.f90: New test. + 2018-03-21 Jakub Jelinek PR tree-optimization/84960 diff --git a/gcc/testsuite/gfortran.dg/pr84957.f90 b/gcc/testsuite/gfortran.dg/pr84957.f90 new file mode 100644 index 00000000000..ba7f4418e57 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr84957.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! PR 84957 +! +! Testcase derived from PR by G. Steinmetz +! +function f() result(u) + entry g() result(v) +contains + function v(x) result(z) + character :: x(2) + character(sum(len_trim(x))) :: z + end function v + function u(x) result(z) + character :: x(2) + character(sum(len_trim(x))) :: z + end function u +end function f