From: Paolo Bonzini <paolo.bonzini@gmail.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc@gcc.gnu.org
Subject: Re: skip_evaluation
Date: Wed, 10 Jun 2009 15:28:00 -0000 [thread overview]
Message-ID: <4A2FD0FE.8090508@gmail.com> (raw)
In-Reply-To: <m37hzkrjjd.fsf@google.com>
> In asking this, I'm particularly puzzled by code like this in
> build_base_path in cp/class.c:
>
> /* Don't bother with the calculations inside sizeof; they'll ICE if the
> source type is incomplete and the pointer value doesn't matter. */
> if (skip_evaluation)
> {
> expr = build_nop (build_pointer_type (target_type), expr);
> if (!want_pointer)
> expr = build_indirect_ref (EXPR_LOCATION (expr), expr, NULL);
> return expr;
> }
>
> Presumably the early return is OK within a sizeof expression; it is OK
> within an expression like (0 ? x : y)?
From reading the code, I'd say yes. The bug that Jason fixed is
related to stuff that cannot appear within a constant expression except
within sizeof -- for example
struct B {};
struct D : public B {
static const int i = sizeof((B*)(D*)0);
};
struct Z {};
struct A : Z {};
Z* implicitToZ (Z*);
struct B : A {
static const int i = sizeof(implicitToZ((B*)0));
};
struct B {};
struct D;
D* p;
struct D: public B {
static const int i = sizeof ((B*)p);
};
(see PR27177). All of these would still be forbidden within (0?x:y).
Paolo
next prev parent reply other threads:[~2009-06-10 15:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 0:59 skip_evaluation Ian Lance Taylor
2009-06-10 15:28 ` Paolo Bonzini [this message]
2009-06-10 15:46 ` skip_evaluation Ian Lance Taylor
2009-06-10 15:51 ` skip_evaluation Paolo Bonzini
2009-06-10 17:04 ` skip_evaluation Gabriel Dos Reis
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=4A2FD0FE.8090508@gmail.com \
--to=paolo.bonzini@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=iant@google.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).