From patchwork Fri Jul 15 20:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 23 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp577562eik; Fri, 15 Jul 2022 13:20:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uT+xor1puBSylxAvbLW+itKfH7oa5G0qxpi/335R/RzYapf3yFshf8ZuI/l2dbYJWLSkea X-Received: by 2002:a17:907:970b:b0:72b:5919:506c with SMTP id jg11-20020a170907970b00b0072b5919506cmr14960026ejc.241.1657916440966; Fri, 15 Jul 2022 13:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657916440; cv=none; d=google.com; s=arc-20160816; b=kqeRjkKXfVUi4yKe5Y40K9e4DVvG2RVsTaywwXQcpJKaR2TsRjh2PQkkM1XCTj2TZo YDH5ZtA6ZouB83zv1Z4rFiBmnvWotwPqjr/ip5gXopsFzRmMWc6DJtKe3a/ePVOdPTZu PT18DBwBpQFC8VUGv8Z6j2w+IF9e95RzaCsjhtoNr/HJH0sNYn4BMD1ZCSTfrPO6a52l k5hZP0JDWb3eyPYx4Kr1vbUi0sML7Xv23QV76xDrqAOeq+8sw+5Tllxs3Ct+tHVPWwIP BHhUHE6H9O1uDgDlgIoaM/MB3ZHHbGE5tRiSyyrpapk90p9P5Cq5h/y0JBEf7aK8pSMf ytJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:sensitivity :importance:date:subject:to:message-id:mime-version:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=9exP4C+wrrKjyVJ2Yqp5oYIFBHzDNhTz12gXJMFa2KU=; b=tAOfQBGowki1KsaStEcnih6Y1VJMgqKgsX1Kl+R8dnv0GFupNu3Fm63JI8/gWafGXs ssnXEdiuUL3VNbnQfjse7QvRdK3hB52djMBwJPmo4Sta8ezyH1H/MoCRb1I4mDH8V3ts WHTPnlTOeUMNs/wDPUrF91Gyxv4wr2xhXh9V1O7R65oKgAWqsp1hNDPqOmpmFuRvm+XV mrxQMDer/m8ivktqsjExJHnyn5Ouu1suEU51sbQMbvfSrzs7+rzbvIeOszt88OclKwV3 DKpHOcVq6lyfkgoRQveGyWt7Q9mlgky4xUQLcNWKir0QiIc8SUglajy5MWznenZmpWvZ hXIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="GK//oMSl"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q8-20020a056402518800b0043a923324c1si7373735edd.11.2022.07.15.13.20.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 13:20:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="GK//oMSl"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 907F6385702E for ; Fri, 15 Jul 2022 20:19:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 907F6385702E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657916394; bh=9exP4C+wrrKjyVJ2Yqp5oYIFBHzDNhTz12gXJMFa2KU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=GK//oMSl97uMZkUMPTh/H2Glk7GgDP/vqes1FKq6MDPC/eTpSllFQHthwplLZ941G xcnILWRx1hKqEzs+KWvFxKho67R/Zg5Kmb632Z8nhWvPObp5TSyHQZhVF0vphLAU+M CPfpyL9p/FQpGRRxUz3WIZ5kFIai0bYV+7S9Ul+Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by sourceware.org (Postfix) with ESMTPS id 02915385AE5B; Fri, 15 Jul 2022 20:18:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 02915385AE5B X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [79.251.14.155] ([79.251.14.155]) by web-mail.gmx.net (3c-app-gmx-bap24.server.lan [172.19.172.94]) (via HTTP); Fri, 15 Jul 2022 22:18:12 +0200 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH, committed] Fortran: do not generate conflicting results under -ff2c [PR104313] Date: Fri, 15 Jul 2022 22:18:12 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:u2/yiNtsPZkMF6KdnTu5ykiX4Yq/+BdwAEjbGZFqGdoeQm+tvXV6IAcP1PhMAgML4u4/L aarhOA2ufmUz1qzZMiLylXKcB/RnFGqKfdN5j72dLgZZQXd/sdL+D1m0Ud+HJ9dOsuqQGY/TdxGk FfBqarN+HCxOZax4x9XedVFceHzyScG72Po+SPSvFhrnyQL2cfGkPntOM22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WL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Harald Anlauf via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: Harald Anlauf Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1738451389876288070?= X-GMAIL-MSGID: =?utf-8?q?1738451389876288070?= Dear all, the attached patch by Steve fixes a regression under -ff2c for functions where the result is not set. There would otherwise be conflicting declarations of the returned result, which gimple doesn't like. I've committed this as obvious after discussion with Steve for him, see PR, as commit r13-1715-g517fb1a78102df43f052c6934c27dd51d786aff7 This fixes a 10/11/12/13 regression, will be backported in the next days. Thanks, Harald From 517fb1a78102df43f052c6934c27dd51d786aff7 Mon Sep 17 00:00:00 2001 From: Steve Kargl Date: Fri, 15 Jul 2022 22:07:15 +0200 Subject: [PATCH] Fortran: do not generate conflicting results under -ff2c [PR104313] gcc/fortran/ChangeLog: PR fortran/104313 * trans-decl.cc (gfc_generate_return): Do not generate conflicting fake results for functions with no result variable under -ff2c. gcc/testsuite/ChangeLog: PR fortran/104313 * gfortran.dg/pr104313.f: New test. --- gcc/fortran/trans-decl.cc | 2 +- gcc/testsuite/gfortran.dg/pr104313.f | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr104313.f diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 6493cc2f6b1..908a4c6d42e 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -6474,7 +6474,7 @@ gfc_generate_return (void) NULL_TREE, and a 'return' is generated without a variable. The following generates a 'return __result_XXX' where XXX is the function name. */ - if (sym == sym->result && sym->attr.function) + if (sym == sym->result && sym->attr.function && !flag_f2c) { result = gfc_get_fake_result_decl (sym, 0); result = fold_build2_loc (input_location, MODIFY_EXPR, diff --git a/gcc/testsuite/gfortran.dg/pr104313.f b/gcc/testsuite/gfortran.dg/pr104313.f new file mode 100644 index 00000000000..89c8947cb0a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr104313.f @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-additional-options "-ff2c -fdump-tree-original" } +! +! PR fortran/104313 - ICE verify_gimple failed with -ff2c +! Contributed by G.Steinmetz + + function f(a) + return + end + +! { dg-final { scan-tree-dump-times "return" 1 "original" } } -- 2.35.3