Message ID | ZJ+cdWQ7BSPhrsT1@Thaum.localdomain |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10804536vqr; Fri, 30 Jun 2023 20:25:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGE+Bug5/ILtT2TM4wsAEDbMdRhMUfuEGmLol2G+t7SbVAV+3NZoW/pBaMirxcXNYf+OZLr X-Received: by 2002:aa7:da9a:0:b0:51d:adc5:22cf with SMTP id q26-20020aa7da9a000000b0051dadc522cfmr3090595eds.9.1688181945550; Fri, 30 Jun 2023 20:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688181945; cv=none; d=google.com; s=arc-20160816; b=FgDIjS/Dpg9uw/T7fYyYwN1EbLQF8GWnU0qSqRAhXF7SgU1A/bqiv+BJTX8WANPaW3 /rCMhQmRL/mDkwkKyzoavyydU7Z+97yNUqUU+Zd6qOLU7ao0p1Pua6YWu+/JeuTeOnCk GLsY3oCz0lfBbLkWSEhGZj3rmyKEKk/VjY7cpBXAYqMtfSC7SS7KNTNPN/lpGt6WmisW w8TXAkuwO/Acc1z5jXAZhHoO1mehjVgfMAhJYCpJKK4vUpgvOWzcI0YWltNA3MMrP6nk rldFehKZSpAxc/hlU80k2ek0u+j3xMvdSV/sgrlVOED6NJVdvUWq1cvLX72bQpLYcAzN jtnw== 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 :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=24mnKWlqrJSHlZBtdLDRiTe+xHiwEs5jenIEey3AJbQ=; fh=rniJ05hh5TtJEgvFF322qtTpFQcCvp9aWk5OC4T+KQA=; b=tY2pzDXj18WU6XOdlIBuUJfKXlCXfpi8AK1HLocJIyR7E4/yw7JpINizR52hlst/Jx kU+gdx6bUqYsIPkJOFuPchH9BwbaLm5ydLRZyz0Fp7OGshMUBUtxQ81SOBgjg+NWeC8x tnIo8YIONBQnyZyXLYF1kNLC3uDjGrF4fDqZHmg4O7HZWt5S039eQ2Znia34EjELLtsF nEgYgeVyrYlPtxHw0knB6xn6WavjOi7p16+rstmjkkj82yDA4KkcrWO21U7ptwPEJXtY Xx4nmT4IwUsuZPo9mzrn7fm9fnHXV5z9TC+1oZFP6wc5WPjBzfJ287QE755bvvzQbQ1S EhVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=aL5S6fnK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y8-20020a50e608000000b0051db8b08c6asi4180876edm.571.2023.06.30.20.25.45 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 20:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=aL5S6fnK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 2AFB43858C74 for <ouuuleilei@gmail.com>; Sat, 1 Jul 2023 03:25:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AFB43858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688181944; bh=24mnKWlqrJSHlZBtdLDRiTe+xHiwEs5jenIEey3AJbQ=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=aL5S6fnKQtADZ6+APQhagvXkAznRVksgBh7hP7svOz7OkOf+7gq3eKYVWler9Jlag eaLB+2VjQ9Rb1mnizYMNSdz5ct6qAB5oPnHnt/zepV7BNOsyZowwA1aKtDV/yW1KFg kcP2Pdz8erkXtvPuGPG2K56e9IWQb53wPPMbxwH0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by sourceware.org (Postfix) with ESMTPS id 61B5F3858D33 for <gcc-patches@gcc.gnu.org>; Sat, 1 Jul 2023 03:24:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61B5F3858D33 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-570877f7838so28825727b3.0 for <gcc-patches@gcc.gnu.org>; Fri, 30 Jun 2023 20:24:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688181887; x=1690773887; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=24mnKWlqrJSHlZBtdLDRiTe+xHiwEs5jenIEey3AJbQ=; b=TPtXU8DG0LE1K/glZEKI7HOCna0cR0Yte/k3kogYro4kN3UNDgaBAySSIYj84dhBbh Y6AUN0wl5ZsUCDl/2wn9pUqcQOTeL6jh2tX+M25IzNo7o6xoedR/52G7kpMRtfNHNHgu jZcbSK/Z9e0+cN0d08aMQFBxwUBUH6Usriq5+7wCs6yckrq3FC2CgCTTibn7LYc07sns BcnSk0qM16PZL/J/KLus7U+WL7IOqLbPP4hpBBCyd01UBtcSF2Li8VVcUu3P8wYpZahp BTYLR5WPSPOzpqZsCZkRke0HTc3zt8wAkO+kcuDygjRhV2js8QCFrE4RQ0kfyNvXKtWP J+3A== X-Gm-Message-State: ABy/qLbzzw1AIYnNXDu27O7sC5uZF5wnihsfYyR+cuxYTffBGrxifZkR DjM2ZETAxUZfyAHny5E+9vvCDplgwqU= X-Received: by 2002:a81:63c6:0:b0:576:7dfc:e73e with SMTP id x189-20020a8163c6000000b005767dfce73emr4431744ywb.32.1688181887523; Fri, 30 Jun 2023 20:24:47 -0700 (PDT) Received: from Thaum.localdomain (59-102-120-25.tpgi.com.au. [59.102.120.25]) by smtp.gmail.com with ESMTPSA id h5-20020a63c005000000b0054ff36967f7sm11149444pgg.54.2023.06.30.20.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 20:24:47 -0700 (PDT) Date: Sat, 1 Jul 2023 13:24:37 +1000 To: gcc-patches@gcc.gnu.org Cc: Patrick Palka <ppalka@redhat.com> Subject: [PATCH v3 0/3] c++: Track lifetimes in constant evaluation [PR70331,...] Message-ID: <ZJ+cdWQ7BSPhrsT1@Thaum.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URI_HEX 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Nathaniel Shead via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Nathaniel Shead <nathanieloshead@gmail.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770187071945364532?= X-GMAIL-MSGID: =?utf-8?q?1770187071945364532?= |
Series |
c++: Track lifetimes in constant evaluation [PR70331,...]
|
|
Message
Nathaniel Shead
July 1, 2023, 3:24 a.m. UTC
This is an update of the patch series at https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614811.html Changes since v2: - Use a separate 'hash_set' to track expired variables instead of adding a flag to 'lang_decl_base'. - Use 'iloc_sentinel' to propagate location information down to subexpressions instead of manually saving and falling back to a parent expression's location. - Update more tests with improved error location information. Bootstrapped and regtested on x86_64-pc-linux-gnu. --- Nathaniel Shead (3): c++: Track lifetimes in constant evaluation [PR70331,PR96630,PR98675] c++: Improve constexpr error for dangling local variables c++: Improve location information in constant evaluation gcc/cp/constexpr.cc | 158 +++++++++++++++--- gcc/cp/semantics.cc | 5 +- gcc/cp/typeck.cc | 5 +- gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C | 10 +- gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C | 8 +- gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C | 8 +- .../g++.dg/cpp0x/constexpr-delete2.C | 5 +- gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C | 1 + .../g++.dg/cpp0x/constexpr-recursion.C | 6 +- gcc/testsuite/g++.dg/cpp0x/overflow1.C | 2 +- gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C | 5 +- gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C | 3 +- .../g++.dg/cpp1y/constexpr-lifetime1.C | 14 ++ .../g++.dg/cpp1y/constexpr-lifetime2.C | 20 +++ .../g++.dg/cpp1y/constexpr-lifetime3.C | 13 ++ .../g++.dg/cpp1y/constexpr-lifetime4.C | 11 ++ .../g++.dg/cpp1y/constexpr-lifetime5.C | 11 ++ .../g++.dg/cpp1y/constexpr-tracking-const14.C | 3 +- .../g++.dg/cpp1y/constexpr-tracking-const16.C | 3 +- .../g++.dg/cpp1y/constexpr-tracking-const18.C | 4 +- .../g++.dg/cpp1y/constexpr-tracking-const19.C | 4 +- .../g++.dg/cpp1y/constexpr-tracking-const21.C | 4 +- .../g++.dg/cpp1y/constexpr-tracking-const22.C | 4 +- .../g++.dg/cpp1y/constexpr-tracking-const3.C | 3 +- .../g++.dg/cpp1y/constexpr-tracking-const4.C | 3 +- .../g++.dg/cpp1y/constexpr-tracking-const7.C | 3 +- gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C | 4 +- gcc/testsuite/g++.dg/cpp1y/pr68180.C | 4 +- .../g++.dg/cpp1z/constexpr-lambda6.C | 4 +- .../g++.dg/cpp1z/constexpr-lambda8.C | 5 +- gcc/testsuite/g++.dg/cpp2a/bit-cast11.C | 10 +- gcc/testsuite/g++.dg/cpp2a/bit-cast12.C | 10 +- gcc/testsuite/g++.dg/cpp2a/bit-cast14.C | 14 +- gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C | 4 +- .../g++.dg/cpp2a/constexpr-dynamic17.C | 5 +- gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C | 5 +- gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C | 6 +- gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C | 10 +- gcc/testsuite/g++.dg/cpp2a/constinit10.C | 5 +- .../g++.dg/cpp2a/is-corresponding-member4.C | 4 +- gcc/testsuite/g++.dg/ext/constexpr-vla2.C | 4 +- gcc/testsuite/g++.dg/ext/constexpr-vla3.C | 4 +- gcc/testsuite/g++.dg/ubsan/pr63956.C | 23 +-- .../g++.dg/warn/Wreturn-local-addr-6.C | 3 - .../25_algorithms/equal/constexpr_neg.cc | 7 +- .../testsuite/26_numerics/gcd/105844.cc | 10 +- .../testsuite/26_numerics/lcm/105844.cc | 14 +- 48 files changed, 330 insertions(+), 143 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime1.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime2.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime3.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime4.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime5.C
Comments
On Sat, 1 Jul 2023, Nathaniel Shead wrote: > This is an update of the patch series at > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614811.html > > Changes since v2: > > - Use a separate 'hash_set' to track expired variables instead of > adding a flag to 'lang_decl_base'. > - Use 'iloc_sentinel' to propagate location information down to > subexpressions instead of manually saving and falling back to a > parent expression's location. > - Update more tests with improved error location information. Thanks very much! This patch series looks good to me. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > > --- > > Nathaniel Shead (3): > c++: Track lifetimes in constant evaluation [PR70331,PR96630,PR98675] > c++: Improve constexpr error for dangling local variables > c++: Improve location information in constant evaluation > > gcc/cp/constexpr.cc | 158 +++++++++++++++--- > gcc/cp/semantics.cc | 5 +- > gcc/cp/typeck.cc | 5 +- > gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C | 10 +- > gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C | 8 +- > gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C | 8 +- > .../g++.dg/cpp0x/constexpr-delete2.C | 5 +- > gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C | 2 +- > gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C | 1 + > .../g++.dg/cpp0x/constexpr-recursion.C | 6 +- > gcc/testsuite/g++.dg/cpp0x/overflow1.C | 2 +- > gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C | 5 +- > gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C | 3 +- > .../g++.dg/cpp1y/constexpr-lifetime1.C | 14 ++ > .../g++.dg/cpp1y/constexpr-lifetime2.C | 20 +++ > .../g++.dg/cpp1y/constexpr-lifetime3.C | 13 ++ > .../g++.dg/cpp1y/constexpr-lifetime4.C | 11 ++ > .../g++.dg/cpp1y/constexpr-lifetime5.C | 11 ++ > .../g++.dg/cpp1y/constexpr-tracking-const14.C | 3 +- > .../g++.dg/cpp1y/constexpr-tracking-const16.C | 3 +- > .../g++.dg/cpp1y/constexpr-tracking-const18.C | 4 +- > .../g++.dg/cpp1y/constexpr-tracking-const19.C | 4 +- > .../g++.dg/cpp1y/constexpr-tracking-const21.C | 4 +- > .../g++.dg/cpp1y/constexpr-tracking-const22.C | 4 +- > .../g++.dg/cpp1y/constexpr-tracking-const3.C | 3 +- > .../g++.dg/cpp1y/constexpr-tracking-const4.C | 3 +- > .../g++.dg/cpp1y/constexpr-tracking-const7.C | 3 +- > gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C | 4 +- > gcc/testsuite/g++.dg/cpp1y/pr68180.C | 4 +- > .../g++.dg/cpp1z/constexpr-lambda6.C | 4 +- > .../g++.dg/cpp1z/constexpr-lambda8.C | 5 +- > gcc/testsuite/g++.dg/cpp2a/bit-cast11.C | 10 +- > gcc/testsuite/g++.dg/cpp2a/bit-cast12.C | 10 +- > gcc/testsuite/g++.dg/cpp2a/bit-cast14.C | 14 +- > gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C | 4 +- > .../g++.dg/cpp2a/constexpr-dynamic17.C | 5 +- > gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C | 5 +- > gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C | 6 +- > gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C | 10 +- > gcc/testsuite/g++.dg/cpp2a/constinit10.C | 5 +- > .../g++.dg/cpp2a/is-corresponding-member4.C | 4 +- > gcc/testsuite/g++.dg/ext/constexpr-vla2.C | 4 +- > gcc/testsuite/g++.dg/ext/constexpr-vla3.C | 4 +- > gcc/testsuite/g++.dg/ubsan/pr63956.C | 23 +-- > .../g++.dg/warn/Wreturn-local-addr-6.C | 3 - > .../25_algorithms/equal/constexpr_neg.cc | 7 +- > .../testsuite/26_numerics/gcd/105844.cc | 10 +- > .../testsuite/26_numerics/lcm/105844.cc | 14 +- > 48 files changed, 330 insertions(+), 143 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime1.C > create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime2.C > create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime3.C > create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime4.C > create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime5.C > > -- > 2.41.0 > >