From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id A6FCC3939C34 for ; Tue, 19 Jan 2021 20:40:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A6FCC3939C34 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-586-nDhAcYIMMPq3ywyZcNMRXQ-1; Tue, 19 Jan 2021 15:40:55 -0500 X-MC-Unique: nDhAcYIMMPq3ywyZcNMRXQ-1 Received: by mail-qv1-f70.google.com with SMTP id l7so20837780qvp.15 for ; Tue, 19 Jan 2021 12:40:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Gk8wRyfJx8fXkTHh0cjXrMIhQGmBkPaKi5SuQpcAg9c=; b=WM8Uxhk54oajAat5aziH7EJbY1Nz+mf03MoM0UHRufoTPMTzKuqryevh8IDfw2wCjt Dee/3zChXCOFcYmmdPeJCEsEv2B9AXtYPagyqng49g6VV0ytGP0fehw1ZXOR9IK7931t LX9Zc4yc1GR8fPMc7JpuksdbFve/SIrrtv12nARrZ8/53/4/lvamYYStgIX5w54daoBj YGYPJqbwz8GOKK3Dar3SlCRfRs1YKgJTgXa0thRCaLFC1G22qpGNeRJZJJtW23EhBZxL Bcy80jSjFcpaxVa+r55jxa/7ninU/HldQ9AcBk+PZWz9FQ0XsVf8ewx7W/XMsY7BI0Vl EDSg== X-Gm-Message-State: AOAM5318r72wYje0uEGTYIwrGCI5ubJdhiB5BNva4sYEv5cw7/VNUdPv EVTHq5MYB39qQh+yNkWzLXIgF0TWkxqCHe0CTbvSf+exzYAja5hyLk/ZeSHxmgt9V9EGUxGdywQ BLhEKbYGMMpGQe3eUDRmEBASvG5hGc+LF3SpOs0PuMibdwWPh/2o/mGucKd9AyrtrNA== X-Received: by 2002:a05:6214:714:: with SMTP id b20mr6093968qvz.36.1611088854340; Tue, 19 Jan 2021 12:40:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwArA2nh3M12QHy2WElVD93Z/sHdiQL4kdU5dxPiy4/nLpzpyFf02dd9bJH9jM60zCjKSvj6A== X-Received: by 2002:a05:6214:714:: with SMTP id b20mr6093939qvz.36.1611088854000; Tue, 19 Jan 2021 12:40:54 -0800 (PST) Received: from [192.168.1.148] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id e10sm12834945qtr.92.2021.01.19.12.40.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 12:40:53 -0800 (PST) Subject: Re: [PATCH] c++: Fix ICE with non-constant satisfaction [PR98644] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20210113170520.2962834-1-ppalka@redhat.com> From: Jason Merrill Message-ID: <9bc4bd4d-eb39-9054-9a80-970cb24d90d2@redhat.com> Date: Tue, 19 Jan 2021 15:40:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210113170520.2962834-1-ppalka@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-16.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Tue, 19 Jan 2021 20:41:00 -0000 On 1/13/21 12:05 PM, Patrick Palka wrote: > In the below testcase, the expression of the atomic constraint after > substitution is (int *) NON_LVALUE_EXPR <1> != 0B which is not a C++ > constant expression, but its TREE_CONSTANT flag is set (from build2), > so satisfy_atom fails to notice that it's non-constant (and we end > up tripping over the assert in satisfaction_value). > > Since TREE_CONSTANT doesn't necessarily correspond to C++ constantness, > this patch makes satisfy_atom instead check is_rvalue_constant_expression. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk/10? > > gcc/cp/ChangeLog: > > PR c++/98644 > * constraint.cc (satisfy_atom): Check is_rvalue_constant_expression > instead of TREE_CONSTANT. > > gcc/testsuite/ChangeLog: > > PR c++/98644 > * g++.dg/cpp2a/concepts-pr98644.C: New test. > --- > gcc/cp/constraint.cc | 2 +- > gcc/testsuite/g++.dg/cpp2a/concepts-pr98644.C | 7 +++++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-pr98644.C > > diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc > index 9049d087859..f99a25dc8a4 100644 > --- a/gcc/cp/constraint.cc > +++ b/gcc/cp/constraint.cc > @@ -2969,7 +2969,7 @@ satisfy_atom (tree t, tree args, sat_info info) > { > result = maybe_constant_value (result, NULL_TREE, > /*manifestly_const_eval=*/true); > - if (!TREE_CONSTANT (result)) This should be sufficient. If the result isn't constant, maybe_constant_value shouldn't return it with TREE_CONSTANT set. See > /* This isn't actually constant, so unset TREE_CONSTANT. in cxx_eval_outermost_constant_expr. Jason