From: Joseph Myers <joseph@codesourcery.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: <paulkoning@comcast.net>, GCC Development <gcc@gcc.gnu.org>
Subject: Re: not computable at load time
Date: Thu, 31 May 2018 16:26:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1805311622260.2935@digraph.polyomino.org.uk> (raw)
In-Reply-To: <CAFiYyc3H4s85r28CDQJcfR8maXcY3=OYe6SX=OAnNnDRMU6w1Q@mail.gmail.com>
On Tue, 29 May 2018, Richard Biener wrote:
> The testcase dates back to some repository creation rev. (egcs?) and
> I'm not sure we may compute the difference of addresses of structure
> members. So that GCC accepts this is probably not required. Joseph
> may have a definitive answer here.
My model of constant expressions for GNU C says this sort of subtraction
(of two address constants based on the same object or function address) is
a symbolic difference constant expression, which should be accepted as
constant in initializers as an extension; it should be folded like other
offsetof-like constructs. That should not depend on whether the result
gets converted to a type of different width.
However, the result of converting an address constant pointer to an
integer type is only expected to be a constant expression if the resulting
type *is* the same width as pointers.
--
Joseph S. Myers
joseph@codesourcery.com
prev parent reply other threads:[~2018-05-31 16:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 18:05 Paul Koning
2018-05-28 9:03 ` Richard Biener
2018-05-28 15:53 ` Andreas Schwab
2018-05-28 16:03 ` Richard Biener
2018-05-28 18:34 ` Paul Koning
2018-05-29 9:49 ` Richard Biener
2018-05-29 13:35 ` Paul Koning
2018-05-29 13:53 ` Jeff Law
2018-05-31 16:26 ` Joseph Myers [this message]
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=alpine.DEB.2.20.1805311622260.2935@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gcc@gcc.gnu.org \
--cc=paulkoning@comcast.net \
--cc=richard.guenther@gmail.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).