public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [C++ PATCH] Fix __builtin_{is_constant_evaluated,constant_p} handling in static_assert (PR c++/86524, PR c++/88446)
Date: Thu, 20 Dec 2018 21:47:00 -0000	[thread overview]
Message-ID: <b8dfe500-c34d-bfcf-ecaf-5e556c690780@redhat.com> (raw)
In-Reply-To: <20181220214035.GR23305@tucnak>

On 12/20/18 4:40 PM, Jakub Jelinek wrote:
> On Thu, Dec 20, 2018 at 04:26:21PM -0500, Jason Merrill wrote:
>> Right, but they either are or they aren't.  Doing this isn't likely to help
>> anything, and can lead to paradoxical results in contrived testcases.
>>
>>> But if you think this is a bad idea, I can remove it, I haven't been
>>> successful in constructing a testcase where this would matter.
>>
>> Please.  OK with those changes.
> 
> Actually, the main reason for any changes in that block was mainly that I thought
> it is a bad idea to fold the argument with __builtin_is_const_evaluated ()
> folded into true if that argument isn't a constant expression.
> 
> So are you ok with what is in the patch below, i.e.
>         {
>           bool non_cst_p = false, ovf_p = false;
>           tree a = cxx_eval_constant_expression (&new_ctx, args[i], false,
>                                                  &non_cst_p, &ovf_p);
>           if ((!non_cst_p && !ovf_p) || !ctx->manifestly_const_eval)
>             args[i] = a;
>         }
> , or perhaps without the || !ctx->manifestly_const_eval?

I don't see how that makes a difference from what was there before; if 
the argument to cxx_eval_constant_expression is non-constant, it returns 
the argument unchanged.

> So, if the
> argument is a constant expression, fold to that, if it is not, just do
> cp_fully_fold on it if it is __builtin_constant_p, otherwise nothing?

Hmm, cp_fully_fold probably also needs to add a manifestly_const_eval 
parameter to pass along to maybe_constant_value.

Jason

  reply	other threads:[~2018-12-20 21:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 22:30 Jakub Jelinek
2018-12-19 10:19 ` Patch ping (Re: [C++ PATCH] Fix __builtin_{is_constant_evaluated,constant_p} handling in static_assert (PR c++/86524, PR c++/88446)) Jakub Jelinek
2018-12-20 19:49 ` [C++ PATCH] Fix __builtin_{is_constant_evaluated,constant_p} handling in static_assert (PR c++/86524, PR c++/88446) Jason Merrill
2018-12-20 21:26   ` Jakub Jelinek
2018-12-20 21:28     ` Jason Merrill
2018-12-20 21:43       ` Jakub Jelinek
2018-12-20 21:47         ` Jason Merrill [this message]
2018-12-20 22:41           ` Jakub Jelinek
2018-12-21  2:51             ` Jason Merrill
2018-12-21  9:05               ` [C++ PATCH] Fix __builtin_{is_constant_evaluated,constant_p} handling in static_assert (PR c++/86524, PR c++/88446, take 2) Jakub Jelinek
2018-12-21 19:31                 ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8dfe500-c34d-bfcf-ecaf-5e556c690780@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).