Hello world,

the attached patch fixes a 5/6/7 regression with -fimplicit-none.

Regression-tested.  OK for all affected branches?

Regards

        Thomas

2016-12-11  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/78239
        * decl.c(char_len_param_value): Also check for -fimplicit-none
        when determining if implicit none is in force.

2016-12-11  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/78239
        * gfortran.dg/fimplicit_none_1.f90:  New test.
        * gfortran.dg/fimplicit_none_2.f90:  New test.

Index: decl.c
===================================================================
--- decl.c	(Revision 243516)
+++ decl.c	(Arbeitskopie)
@@ -922,7 +922,8 @@ char_len_param_value (gfc_expr **expr, bool *defer
 
       if (!t && e->ts.type == BT_UNKNOWN
 	  && e->symtree->n.sym->attr.untyped == 1
-	  && (e->symtree->n.sym->ns->seen_implicit_none == 1
+	  && (flag_implicit_none
+	      || e->symtree->n.sym->ns->seen_implicit_none == 1
 	      || e->symtree->n.sym->ns->parent->seen_implicit_none == 1))
 	{
 	  gfc_free_expr (e);
! { dg-do compile }
! { dg-options "-fimplicit-none" }
! PR fortran/78239 - used to ICE
subroutine s(n) ! { dg-error "has no IMPLICIT type" }
   character(n) :: c  ! { dg-error "Scalar INTEGER expression expected" }
   c = 'c' ! { dg-error "has no IMPLICIT type" }
end
! { dg-do compile }
! { dg-options "-fimplicit-none" }
! PR fortran/78239 - used to ICE
program p
   character(*), parameter :: z(2) = [character(n) :: 'x', 'y'] ! { dg-error "Scalar INTEGER expression expected" }
end

Reply via email to