re PR fortran/86110 (ICE in gfc_resolve_character_array_constructor, at fortran/array...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 13 Jun 2018 19:37:50 +0000 (19:37 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 13 Jun 2018 19:37:50 +0000 (19:37 +0000)
2018-06-13  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/86110
* array.c (gfc_resolve_character_array_constructor): Avoid NULL
pointer dereference.

2018-06-13  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/86110
* gfortran.dg/pr86110.f90: New test.

From-SVN: r261561

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

index 25b5f37de5511b95b74c4abe0067609375f43125..05397b92dfa9ec46d4d4a953c04895502ba775c3 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-13  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/86110
+       * array.c (gfc_resolve_character_array_constructor): Avoid NULL 
+       pointer dereference.
+
 2018-06-13  Cesar Philippidis  <cesar@codesourcery.com>
 
        PR fortran/85703
index 031ab7643a5d75f95065599ed05d48454f2359c4..e4926d751471d58937eb6f762b9cbd800924adbb 100644 (file)
@@ -2040,7 +2040,9 @@ got_charlen:
          gfc_ref *ref;
          for (ref = p->expr->ref; ref; ref = ref->next)
            if (ref->type == REF_SUBSTRING
+               && ref->u.ss.start
                && ref->u.ss.start->expr_type == EXPR_CONSTANT
+               && ref->u.ss.end
                && ref->u.ss.end->expr_type == EXPR_CONSTANT)
              break;
 
index c56ef09f72694e9b809fd33042fbbf33b36cadc3..0797df7ea5f6fa9a92422e0745db1662985b9b57 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-13  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/86110
+       * gfortran.dg/pr86110.f90: New test.
+
 2018-06-13  Cesar Philippidis  <cesar@codesourcery.com>
 
        PR fortran/85703
diff --git a/gcc/testsuite/gfortran.dg/pr86110.f90 b/gcc/testsuite/gfortran.dg/pr86110.f90
new file mode 100644 (file)
index 0000000..890670f
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/86110
+program p
+   character(:), allocatable :: x, y
+   x = 'abc'
+   y = [x(:)]  ! { dg-error "Incompatible ranks 0 and 1" }
+end