From patchwork Sat Aug 4 14:50:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 953465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-483165-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lncNpVDd"; dkim-atps=neutral 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 41jRfr545kz9s3q for ; Sun, 5 Aug 2018 00:50:42 +1000 (AEST) Received: (qmail 114305 invoked by alias); 4 Aug 2018 14:50:33 -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 114283 invoked by uid 89); 4 Aug 2018 14:50:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yb0-f182.google.com Received: from mail-yb0-f182.google.com (HELO mail-yb0-f182.google.com) (209.85.213.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Aug 2018 14:50:26 +0000 Received: by mail-yb0-f182.google.com with SMTP id e9-v6so3753846ybq.1; Sat, 04 Aug 2018 07:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=WB8QDxL2l4UEWda5rKpL3QvaxTwdexSwYmgibf5kKw8=; b=lncNpVDd41puT1FJeHN30RqGCdvrFNfEmV3ISDKxgdOGah/2P5Gk5JtCDURPqCXseO UqbW1BAyYrQ0+ybkhncXgvASElXNQ4a9fscPv4pHi9g7NAsBfyrE8hwbZqJzaYB9eROH jtyt5BFjGB0AFvq1sKWW1TWpHziCBp7U7cjIZYgQPZ/M7gFOFIsE9zW+sBEqEBEDP7bS 1PiHkbC01pJbbpXpe/rSfa1lAG1hgpicvCK5hLFoiekEoMnKRUfiEsQjtL9o2BW7CDX0 MKq3BwQ1hMQvQ5E1oIJrlrVozx+7O1dPhvhXsfcrf3T73BM+RMVn1TwS9M1WlTpz2MBk Qgfw== MIME-Version: 1.0 Sender: jaydub66@gmail.com Received: by 2002:a0d:ea0c:0:0:0:0:0 with HTTP; Sat, 4 Aug 2018 07:50:23 -0700 (PDT) From: Janus Weil Date: Sat, 4 Aug 2018 16:50:23 +0200 Message-ID: Subject: [Patch, Fortran, F08] PR 45521: GENERIC resolution with ALLOCATABLE/POINTER and PROCEDURE To: gfortran , gcc-patches Hi all, this patch should finally fix up the last wrinkles of PR 45521, which deals with disambiguating specific procedures in a generic interface via the pointer/allocatable attributes of the arguments (legal in F08). For 'ordinary' generic interfaces this already works (cf. 'generic_correspondence'), but not for operator interfaces, which are treated a bit differently (see 'gfc_compare_interfaces'). The patch basically copies over the usage of 'compare_ptr_alloc' from 'generic_correspondence' to the relevant part of 'gfc_compare_interfaces'. Regtests cleanly on x86_64-linux-gnu. Ok for trunk? Cheers, Janus 2018-08-04 Janus Weil PR fortran/45521 * interface.c (gfc_compare_interfaces): Apply additional distinguishability criteria of F08 to operator interfaces. 2018-08-04 Janus Weil PR fortran/45521 * gfortran.dg/interface_assignment_6.f90: New test case. Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 263178) +++ gcc/fortran/interface.c (working copy) @@ -1776,7 +1776,7 @@ } else { - /* Only check type and rank. */ + /* Operators: Only check type and rank of arguments. */ if (!compare_type (f2->sym, f1->sym)) { if (errmsg != NULL) @@ -1794,6 +1794,15 @@ symbol_rank (f2->sym)); return false; } + if ((gfc_option.allow_std & GFC_STD_F2008) + && (compare_ptr_alloc(f1->sym, f2->sym) + || compare_ptr_alloc(f2->sym, f1->sym))) + { + if (errmsg != NULL) + snprintf (errmsg, err_len, "Mismatching POINTER/ALLOCATABLE " + "attribute in argument '%s' ", f1->sym->name); + return false; + } } }