re PR fortran/84957 (ICE in gfc_sym_type, at fortran/trans-types.c:2255)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 21 Mar 2018 21:12:41 +0000 (21:12 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 21 Mar 2018 21:12:41 +0000 (21:12 +0000)
2018-03-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
Harald Anlauf  <anlauf@gmx.de>

PR fortran/84957
* trans-types.c (gfc_sym_type): Do not dereference NULL pointer.

2018-03-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
Harald Anlauf  <anlauf@gmx.de>

PR fortran/84957
* gfortran.dg/pr84957.f90: New test.

Co-Authored-By: Harald Anlauf <anlauf@gmx.de>
From-SVN: r258745

gcc/fortran/ChangeLog
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr84957.f90 [new file with mode: 0644]

index b69b559cae7fb7cb77e9de60e23ff6b682c1878c..87c78ebdc1516dcf9418c49b347facc52fe6aa89 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
+       Harald Anlauf  <anlauf@gmx.de>
+
+       PR fortran/84957
+       * trans-types.c (gfc_sym_type): Do not dereference NULL pointer.
+
 2018-03-21  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR fortran/84615
index 20de203e6074fbb8e1ef0d1944f1af47988400cd..7ff27a3650c4473a4dda3b1f2087d215f90b13c2 100644 (file)
@@ -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;
 
index faf418dd1b1fd226af477506823014fc6459a783..cc81884b4f3a5bba08baf04b7af0f3c92fad977c 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
+       Harald Anlauf  <anlauf@gmx.de>
+
+       PR fortran/84957
+       * gfortran.dg/pr84957.f90: New test.
+
 2018-03-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/84960
diff --git a/gcc/testsuite/gfortran.dg/pr84957.f90 b/gcc/testsuite/gfortran.dg/pr84957.f90
new file mode 100644 (file)
index 0000000..ba7f441
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! PR 84957
+!
+! Testcase derived from PR by G. Steinmetz  <gscfq@t-online.de>
+!
+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