From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15661 invoked by alias); 12 Dec 2018 01:11:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 15643 invoked by uid 89); 12 Dec 2018 01:11:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk1-f195.google.com Received: from mail-qk1-f195.google.com (HELO mail-qk1-f195.google.com) (209.85.222.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Dec 2018 01:11:29 +0000 Received: by mail-qk1-f195.google.com with SMTP id y16so9818724qki.7 for ; Tue, 11 Dec 2018 17:11:29 -0800 (PST) Return-Path: Received: from [192.168.1.132] (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 f31sm10450095qtc.42.2018.12.11.17.11.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:11:26 -0800 (PST) Subject: Re: [C++ PATCH] Fix up __builtin_is_constant_evaluated (PR c++/88449) To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org References: <20181211163418.GW12380@tucnak> From: Jason Merrill Message-ID: <51429a30-e72a-5066-1dff-040d33e4ebd5@redhat.com> Date: Wed, 12 Dec 2018 01:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181211163418.GW12380@tucnak> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00760.txt.bz2 On 12/11/18 11:34 AM, Jakub Jelinek wrote: > Hi! > > While working on the libstdc++ patch for P0595R2, I've noticed that while > __builtin_is_constant_evaluated () directly works, when wrapped into > an constexpr inline noexcept function, it in some cases doesn't. The > problem is that the constexpr call cache didn't take > ctx->pretend_const_required into account. > > The following patch fixes it by just treating it like another magic > parameter. Another option would be (but much more involved) to remember > during the constexpr.c processing whether we've seen during the evaluation > any calls to __builtin_is_constant_evaluated (that would require propagating > in all the spots that use a new context back to the old context). Then > we could in the constexpr hash remember either that during the evaluation > of that constexpr call there was no __builtin_is_constant_evaluated seen, > or, if it has been seen, whether it was in ctx->pretend_const_required > mode or in !ctx->pretend_const_required mode. > > I've bootstrapped/regtested on x86_64-linux and i686-linux the following > simpler version, ok for trunk? OK. Jason