re PR fortran/77612 (ICE on invalid character len in contained procedure)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 16 Sep 2016 17:55:38 +0000 (17:55 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 16 Sep 2016 17:55:38 +0000 (17:55 +0000)
2016-09-16  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/77612
* decl.c (char_len_param_value): Check parent namespace for
seen_implicit_none.

2016-09-16  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/77612
* gfortran.dg/pr77612.f90: New test.

From-SVN: r240191

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

index ffc859a41283aa04480a6d55f179ec7d55ee7ac9..5954c73f4047a3e23bdb00f1601669ef23f5a3e0 100644 (file)
@@ -1,4 +1,11 @@
+2016-09-16  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/77612
+       * decl.c (char_len_param_value): Check parent namespace for 
+       seen_implicit_none.
+
 2016-09-15  Louis Krupp  <louis.krupp@zoho.com>
+
        PR fortran/69963
        * parse.c (reject_statement): Clear charlen pointers in implicit
        character typespecs before those charlen structures are freed.
index b5242394cefc65cae27b142fee6b97bca21e08f3..c83e9d4d7915c140e4668627120dc200e6959f8e 100644 (file)
@@ -920,9 +920,10 @@ char_len_param_value (gfc_expr **expr, bool *deferred)
 
       t = gfc_reduce_init_expr (e);
 
-      if (!t && (e->ts.type == BT_UNKNOWN
-                && e->symtree->n.sym->attr.untyped == 1
-                && e->symtree->n.sym->ns->seen_implicit_none == 1))
+      if (!t && e->ts.type == BT_UNKNOWN
+         && e->symtree->n.sym->attr.untyped == 1
+         && (e->symtree->n.sym->ns->seen_implicit_none == 1
+             || e->symtree->n.sym->ns->parent->seen_implicit_none == 1))
        {
          gfc_free_expr (e);
          goto syntax;
index 2cb03482ba2fb6bcb8f9a331d1495ce605b3837b..3c992548d111a139a761b2097d647161aacd704b 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-16  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/77612
+       * gfortran.dg/pr77612.f90: New test.
+
 2016-09-16  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
        * gcc.dg/torture/pr70421.c: Require int32plus.
diff --git a/gcc/testsuite/gfortran.dg/pr77612.f90 b/gcc/testsuite/gfortran.dg/pr77612.f90
new file mode 100644 (file)
index 0000000..7bc5a49
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+
+program bad_len
+
+  implicit none
+
+contains
+
+  subroutine sub
+    character(len = ICE) :: line ! { dg-error "INTEGER expression expected" }
+  end subroutine
+
+end program