re PR fortran/87992 (ICE in resolve_fl_variable, at fortran/resolve.c:12314)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 19 Dec 2018 22:31:25 +0000 (22:31 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 19 Dec 2018 22:31:25 +0000 (22:31 +0000)
2018-12-19  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/87992
* resolve.c (resolve_fl_variable): Avoid a NULL pointer.

2018-12-19  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/87992
* gfortran.dg/pr87992.f90: New test.

From-SVN: r267288

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr87992.f90 [new file with mode: 0644]

index 88acec1f38a9bb0a4b765d89b37128db48fbe856..04eade51b47e219bdcda50add080f06de0b7389f 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-19  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/87992
+       * resolve.c (resolve_fl_variable): Avoid a NULL pointer.
+
 2018-12-16  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * resolve.c (resolve_transfer): Remove dead code.
index fedf60ae770056604119f6a3e83aea9f7165a59b..9ce01c7dd4280a89628f04f0b0dbfd23278cc70d 100644 (file)
@@ -12310,7 +12310,11 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
     {
       /* Make sure that character string variables with assumed length are
         dummy arguments.  */
-      e = sym->ts.u.cl->length;
+      if (sym->ts.u.cl)
+       e = sym->ts.u.cl->length;
+      else
+       return false;
+
       if (e == NULL && !sym->attr.dummy && !sym->attr.result
          && !sym->ts.deferred && !sym->attr.select_type_temporary
          && !sym->attr.omp_udr_artificial_var)
index 6a3ed92857e73170f62abc51f61ab94a2aac0be4..bc8f8994d92ac1d82d77a59daa8b4329fc199f2a 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-19  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/87992
+       * gfortran.dg/pr87992.f90: New test.
+
 2018-12-19  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/avx512dq-pr82855.c: Update scan-assembler pattern.
diff --git a/gcc/testsuite/gfortran.dg/pr87992.f90 b/gcc/testsuite/gfortran.dg/pr87992.f90
new file mode 100644 (file)
index 0000000..cbde0d0
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+subroutine s(x)
+   class(*), allocatable :: x
+   x = ''
+end