This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] Fix ICEs with -fimplicit-none
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 11 Dec 2016 23:21:38 +0100
- Subject: [patch, fortran] Fix ICEs with -fimplicit-none
- Authentication-results: sourceware.org; auth=none
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 <tkoenig@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 <tkoenig@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