public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed] Fix PR fortran/77612
@ 2016-09-16 18:09 Steve Kargl
  0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2016-09-16 18:09 UTC (permalink / raw)
  To: fortran, gcc-patches

I've committed the following patch.

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.


Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 240140)
+++ gcc/fortran/decl.c	(working copy)
@@ -920,9 +920,10 @@ char_len_param_value (gfc_expr **expr, b
 
       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: gcc/testsuite/gfortran.dg/pr77612.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77612.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77612.f90	(working copy)
@@ -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
-- 
Steve

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-16 17:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 18:09 [Committed] Fix PR fortran/77612 Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).