From patchwork Mon Dec 15 13:19:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 421199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 60D521400B7 for ; Tue, 16 Dec 2014 00:19:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=Il4UUUZ0EQjw6d/NtdUCPNpJopmv1gXChw75Iz0OUyBrFb BE+/Ge6DB/UR3CTSuMh3gaURYCqPxSJj5vMWZ2RpLzBHp4Qw7rT1h4zwte3EeUiE 8J2Kd1I7iGL8uPSvL5/d5l7Q6Z+HDAssVRZEzofZRr0JyIC8+QuCjrhGgX3nc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=VABWXybIUXlPOLanxnGc/tYS6W8=; b=fBSusmofFkJ0miuoUwYx gd9DJGyUApAd6EDk1jIbinx4niP3muDT+4Ox11tjZasPUQhq55oNlEqwMueyaKbY RZn0q95KQgdgRTWbOL2goavbR95n4wdp70GN30inPTEhN0y/PRgVllg3RaQPCdxW 37NvLnPN7VB9fjNEktO+Gbw= Received: (qmail 16702 invoked by alias); 15 Dec 2014 13:19:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 16677 invoked by uid 89); 15 Dec 2014 13:19:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-qa0-f46.google.com Received: from mail-qa0-f46.google.com (HELO mail-qa0-f46.google.com) (209.85.216.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 15 Dec 2014 13:19:29 +0000 Received: by mail-qa0-f46.google.com with SMTP id n8so7946235qaq.19 for ; Mon, 15 Dec 2014 05:19:27 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.224.3.137 with SMTP id 9mr56632123qan.64.1418649567526; Mon, 15 Dec 2014 05:19:27 -0800 (PST) Received: by 10.96.54.194 with HTTP; Mon, 15 Dec 2014 05:19:27 -0800 (PST) Date: Mon, 15 Dec 2014 14:19:27 +0100 Message-ID: Subject: [Patch, Fortran] PR 63727: Checks missing for proc-pointer components: Usage as actual argument when elemental From: Janus Weil To: gfortran , gcc-patches Hi all, here is another small diagnostic enhancement for procedure pointer components. Regtested on x86_64-unknown-linux-gnu. Ok for trunk? (I'm not adding a dedicated test case, since coarray_collectives_14 already includes this case as a FIXME, which I now transformed into a dg-error.) Cheers, Janus 2014-12-15 Janus Weil PR fortran/63727 * resolve.c (resolve_actual_arglist): Check for elemental procedure pointer components. 2014-12-15 Janus Weil PR fortran/63727 * gfortran.dg/coarray_collectives_14.f90: Address FIXME item. Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (Revision 218721) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -1740,6 +1740,7 @@ resolve_actual_arglist (gfc_actual_arglist *arg, p gfc_symbol *sym; gfc_symtree *parent_st; gfc_expr *e; + gfc_component *comp; int save_need_full_assumed_size; bool return_value = false; bool actual_arg_sav = actual_arg, first_actual_arg_sav = first_actual_arg; @@ -1967,6 +1968,14 @@ resolve_actual_arglist (gfc_actual_arglist *arg, p } } + comp = gfc_get_proc_ptr_comp(e); + if (comp && comp->attr.elemental) + { + gfc_error ("ELEMENTAL procedure pointer component %qs is not " + "allowed as an actual argument at %L", comp->name, + &e->where); + } + /* Fortran 2008, C1237. */ if (e->expr_type == EXPR_VARIABLE && gfc_is_coindexed (e) && gfc_has_ultimate_pointer (e)) Index: gcc/testsuite/gfortran.dg/coarray_collectives_14.f90 =================================================================== --- gcc/testsuite/gfortran.dg/coarray_collectives_14.f90 (Revision 218721) +++ gcc/testsuite/gfortran.dg/coarray_collectives_14.f90 (Arbeitskopie) @@ -62,7 +62,7 @@ program test call co_reduce(caf, arg3) ! { dg-error "shall have two arguments" } call co_reduce(caf, dt%arg3) ! { dg-error "shall have two arguments" } call co_reduce(caf, elem) ! { dg-error "ELEMENTAL non-INTRINSIC procedure 'elem' is not allowed as an actual argument" } - call co_reduce(caf, dt%elem) ! { FIXME: "ELEMENTAL non-INTRINSIC procedure 'elem' is not allowed as an actual argument" } + call co_reduce(caf, dt%elem) ! { dg-error "ELEMENTAL procedure pointer component 'elem' is not allowed as an actual argument" } call co_reduce(caf, realo) ! { dg-error "A argument at .1. has type INTEGER.4. but the function passed as OPERATOR at .2. returns REAL.4." } call co_reduce(caf, dt%realo) ! { dg-error "A argument at .1. has type INTEGER.4. but the function passed as OPERATOR at .2. returns REAL.4." } call co_reduce(caf, int8) ! { dg-error "A argument at .1. has type INTEGER.4. but the function passed as OPERATOR at .2. returns INTEGER.8." }