From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9027 invoked by alias); 22 Jul 2007 21:45:21 -0000 Received: (qmail 9012 invoked by uid 22791); 22 Jul 2007 21:45:19 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.185) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 22 Jul 2007 21:45:15 +0000 Received: by nf-out-0910.google.com with SMTP id h3so90280nfh for ; Sun, 22 Jul 2007 14:45:12 -0700 (PDT) Received: by 10.86.77.5 with SMTP id z5mr2009050fga.1185140711855; Sun, 22 Jul 2007 14:45:11 -0700 (PDT) Received: from e177202151.adsl.alicedsl.de ( [85.177.202.151]) by mx.google.com with ESMTPS id w7sm19014039mue.2007.07.22.14.45.10 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jul 2007 14:45:11 -0700 (PDT) From: Daniel Franke To: fortran@gcc.gnu.org Subject: [fortran, ptach] initialization expressions, update Date: Mon, 23 Jul 2007 00:14:00 -0000 User-Agent: KMail/1.9.7 Cc: gcc-patches@gcc.gnu.org MIME-Version: 1.0 Message-Id: <200707222345.05430.franke.daniel@gmail.com> Content-Type: Multipart/Mixed; boundary="Boundary-00=_h/8oGTaCWWVcyEb" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-07/txt/msg01654.txt.bz2 --Boundary-00=_h/8oGTaCWWVcyEb Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 876 The original testcase of PR31639 still results in an ICE if -std=gnu but is handled correctly if -std=f95 or -std=f2003. This update changes the related gfc_notify_std() to gfc_error(). Further, as F2003 allows more transformational intrinsics in initialization expressions than F95, we ICE on those as shown in PR25104. The second part of the patch changes this ice-on-valid to reject-valid for now. 2007-07-22 Daniel Franke PR fortran/25104 PR fortran/31639 * expr.c(check_transformational): Reject valid transformational intrinsics to avoid ICE. (check_inquiry): Report error for assumed character lengths for all supported standards. 2007-07-22 Daniel Franke PR fortran/31639 * gfortran.dg/initialization_9.f90: New test. Regression tested on i686-pc-linux-gnu. Ok for trunk? Regards Daniel --Boundary-00=_h/8oGTaCWWVcyEb Content-Type: text/x-diff; charset="us-ascii"; name="init-expr-update.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="init-expr-update.patch" Content-length: 2073 Index: fortran/expr.c =================================================================== --- fortran/expr.c (revision 126826) +++ fortran/expr.c (working copy) @@ -1966,9 +1966,8 @@ && ap->expr->symtree->n.sym->ts.type == BT_CHARACTER && ap->expr->symtree->n.sym->ts.cl->length == NULL) { - if (gfc_notify_std (GFC_STD_GNU, "assumed character length " - "variable '%s' in constant expression at %L", - e->symtree->n.sym->name, &e->where) == FAILURE) + gfc_error ("assumed character length variable '%s' in constant " + "expression at %L", e->symtree->n.sym->name, &e->where); return MATCH_ERROR; } else if (not_restricted && check_init_expr (ap->expr) == FAILURE) @@ -2007,11 +2006,23 @@ if (strcmp (trans_func_f95[i], name) == 0) break; + /* FIXME, F2003: implement translation of initialization + expressions before enabling this check. For F95, error + out if the transformational function is not in the list. */ +#if 0 if (trans_func_f95[i] == NULL && gfc_notify_std (GFC_STD_F2003, "transformational intrinsic '%s' at %L is not permitted " "in an initialization expression", name, &e->where) == FAILURE) return MATCH_ERROR; +#else + if (trans_func_f95[i] == NULL) + { + gfc_error("transformational intrinsic '%s' at %L is not permitted " + "in an initialization expression", name, &e->where); + return MATCH_ERROR; + } +#endif return check_init_expr_arguments (e); } Index: testsuite/gfortran.dg/initialization_9.f90 =================================================================== --- testsuite/gfortran.dg/initialization_9.f90 (revision 0) +++ testsuite/gfortran.dg/initialization_9.f90 (revision 0) @@ -0,0 +1,11 @@ +! { dg-do compile } +! +! PR fortran/31639 +! Contributed by Martin Michlmayr T cyrius DOT com> + + integer function xstrcmp(s1) + character*(*), intent(in) :: s1 + integer :: n1 = len(s1) ! { dg-error "assumed character length variable" } + n1 = 1 + return + end function xstrcmp --Boundary-00=_h/8oGTaCWWVcyEb--