From patchwork Sat Jan 12 04:34:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 1023845 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-493919-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Y/OfU7Ei"; 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 43c6Mf2b7Qz9s55 for ; Sat, 12 Jan 2019 15:34:35 +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:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=cm9XDmBG/VgzdtKGhD/flsTuxG/EjzBNNWhGswYg99H Vva6dirHO4nudbcXD0lMZkvvfUZHWo57UaxyxUt8Mi0vl+Idzr0R2Y/aoOTi3nKx Vsc9UdP+FmbRcsQadXpD5b+QMWUQBMIvcZt1dEUYduDjCDctdX93ur4y2WmIsS2E = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=cvZHYGmXVO/5NjrDzQCi2QUHFsU=; b=Y/OfU7EiyZ7E4LULC 4kSnTUN/QF0+uf5+6wtPiTjAxEVLHseGkF1bjVNINfbpD1rZDxWlNeZCNhXeWpgi ZUmG4Hu7ykFa2UiBHjwapTZ91MP7K81OzFsb/OdwuJ4AHHLSpkcb487Ke5Eglzg7 W45YnApQzemAPvN8vSY7Le5Bp8= Received: (qmail 64183 invoked by alias); 12 Jan 2019 04:34:27 -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 64165 invoked by uid 89); 12 Jan 2019 04:34:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, KAM_STOCKGEN autolearn=ham version=3.3.2 spammy=Break, proc_name, prevent X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Jan 2019 04:34:24 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id x0C4YMtD075339 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 11 Jan 2019 20:34:23 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id x0C4YMTV075338; Fri, 11 Jan 2019 20:34:22 -0800 (PST) (envelope-from sgk) Date: Fri, 11 Jan 2019 20:34:22 -0800 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR fortran/61765 -- Avoid ENTRY names in check of repeditive symbols Message-ID: <20190112043422.GA75319@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) The attached patch has been tested on x86_64-*-freebsd. There were no regression. The patch is less then obvious, but simple. OK to commit? 2019-01-11 Steven G. Kargl PR fortran/61765 * resolve.c (gfc_verify_binding_labels): Break if-elseif-elseif structure into independent if's with a return to simplify logic. Avoid a check for ENTRY name with bind(c). 2019-01-11 Steven G. Kargl PR fortran/61765 * gfortran.dg/pr61765.f90: New test. Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 267862) +++ gcc/fortran/resolve.c (working copy) @@ -11789,11 +11789,12 @@ gfc_verify_binding_labels (gfc_symbol *sym) sym->binding_label, &sym->declared_at, &gsym->where); /* Clear the binding label to prevent checking multiple times. */ sym->binding_label = NULL; - + return; } - else if (sym->attr.flavor == FL_VARIABLE && module - && (strcmp (module, gsym->mod_name) != 0 - || strcmp (sym->name, gsym->sym_name) != 0)) + + if (sym->attr.flavor == FL_VARIABLE && module + && (strcmp (module, gsym->mod_name) != 0 + || strcmp (sym->name, gsym->sym_name) != 0)) { /* This can only happen if the variable is defined in a module - if it isn't the same module, reject it. */ @@ -11802,14 +11803,16 @@ gfc_verify_binding_labels (gfc_symbol *sym) sym->name, module, sym->binding_label, &sym->declared_at, &gsym->where, gsym->mod_name); sym->binding_label = NULL; + return; } - else if ((sym->attr.function || sym->attr.subroutine) - && ((gsym->type != GSYM_SUBROUTINE && gsym->type != GSYM_FUNCTION) - || (gsym->defined && sym->attr.if_source != IFSRC_IFBODY)) - && sym != gsym->ns->proc_name - && (module != gsym->mod_name - || strcmp (gsym->sym_name, sym->name) != 0 - || (module && strcmp (module, gsym->mod_name) != 0))) + + if ((sym->attr.function || sym->attr.subroutine) + && ((gsym->type != GSYM_SUBROUTINE && gsym->type != GSYM_FUNCTION) + || (gsym->defined && sym->attr.if_source != IFSRC_IFBODY)) + && (sym != gsym->ns->proc_name && sym->attr.entry == 0) + && (module != gsym->mod_name + || strcmp (gsym->sym_name, sym->name) != 0 + || (module && strcmp (module, gsym->mod_name) != 0))) { /* Print an error if the procedure is defined multiple times; we have to exclude references to the same procedure via module association or Index: gcc/testsuite/gfortran.dg/pr61765.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr61765.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr61765.f90 (working copy) @@ -0,0 +1,15 @@ +! { dg-do compile } + subroutine sub1(x) + integer, intent(in) :: x + entry sub1_c(x) bind(c) + end subroutine sub1 + + subroutine sub2_c(x) bind(c) + integer, intent(in) :: x + entry sub2(x) + end subroutine sub2_c + + subroutine sub3_c(x) bind(c) + integer, intent(in) :: x + entry sub3_c_c(x) bind(c) + end subroutine sub3_c