From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7738 invoked by alias); 1 Feb 2011 11:33:57 -0000 Received: (qmail 7730 invoked by uid 22791); 1 Feb 2011 11:33:56 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Feb 2011 11:33:52 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47569] [4.3/4.4/4.5/4.6 Regression] gfortran does not detect that the parameters for passing a partial string to a subroutine are incorrect X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 01 Feb 2011 11:33:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00060.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47569 --- Comment #2 from Tobias Burnus 2011-02-01 11:33:33 UTC --- A bit unrelated to the reported problem, but I wonder whether the coarray/coindexed part is already correctly checked for: "If the actual argument is a coindexed scalar, the corresponding dummy argument shall be scalar. If the actual argument is a noncoindexed scalar, the corresponding dummy argument shall be scalar unless the actual argument is default character, of type character with the C character kind (15.2.2), or is an element or substring of an element of an array that is not an assumed-shape, pointer, or polymorphic array." (F2008) * * * Draft patch: diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 1e5df61..28daf8a 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1672,7 +1672,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, return 1; /* At this point, we are considering a scalar passed to an array. This - is valid (cf. F95 12.4.1.1; F2003 12.4.1.2), + is valid (cf. F95 12.4.1.1 and F2008 12.5.2.4; F2003 12.4.1.2), - if the actual argument is (a substring of) an element of a non-assumed-shape/non-pointer array; - (F2003) if the actual argument is of type character. */ @@ -1686,8 +1686,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, if (formal->ts.type == BT_CHARACTER && (ref == NULL || (actual->expr_type == EXPR_VARIABLE - && (actual->symtree->n.sym->as->type == AS_ASSUMED_SHAPE - || actual->symtree->n.sym->attr.pointer)))) + && (ref->u.ar.as->type == AS_ASSUMED_SHAPE + || gfc_expr_attr (actual).pointer)))) { if (where && (gfc_option.allow_std & GFC_STD_F2003) == 0) {