public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: paulkoning@comcast.net, "Joseph S. Myers" <joseph@codesourcery.com>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: not computable at load time
Date: Tue, 29 May 2018 09:49:00 -0000	[thread overview]
Message-ID: <CAFiYyc3H4s85r28CDQJcfR8maXcY3=OYe6SX=OAnNnDRMU6w1Q@mail.gmail.com> (raw)
In-Reply-To: <5D1DB310-D460-4A04-A0ED-8C9941D8A9F9@comcast.net>

On Mon, May 28, 2018 at 8:34 PM Paul Koning <paulkoning@comcast.net> wrote:



> > On May 28, 2018, at 12:03 PM, Richard Biener
> <richard.guenther@gmail.com>
wrote:
> >
> > On May 28, 2018 12:45:04 PM GMT+02:00, Andreas Schwab <schwab@suse.de>
wrote:
> >> On Mai 28 2018, Richard Biener <richard.guenther@gmail.com> wrote:
> >>
> >>> It means there's no relocation that can express the result of 's.f -
> >> &s.b'
> >>> and the frontend doesn't consider this a constant expression (likely
> >> because
> >>> of the conversion).
> >>
> >> Shouldn't the frontend notice that s.f - &s.b by itself is a constant?
> >
> > Sure - the question is whether it is required to and why it doesn't.

> This is a test case in the C torture test suite.  The only  reason
> I can see for it being there is to verify that GCC resolves this as
> a compile time constant.

> The issue can be masked by changing the "long" in that test case to
> a ptrdiff_t, which eliminates the conversion.  Should I do that?
> It would make the test pass, at the expense of masking this glitch.

> By the way, I get the same error if I change the "long" to a "long long"
> and them compile for 32-bit Intel.

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.

It might be a "regression" with the POINTER_MINUS_EXPR introduction.
You can debug this with gdb when you break on 'pointer_diff'.  For me
on x86_64 this builds a POINTER_DIFF_EXPR: (char *) &s.f - &s.b
of ptrdiff_t.  That a conversion breaks the simplification tells us that
somewhere we possibly fail to simplify it (maybe even during assembling).

You might want to file a bug for the 'long long' issue.

Richard.


>          paul

  reply	other threads:[~2018-05-29  9:49 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 [this message]
2018-05-29 13:35           ` Paul Koning
2018-05-29 13:53           ` Jeff Law
2018-05-31 16:26           ` Joseph Myers

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='CAFiYyc3H4s85r28CDQJcfR8maXcY3=OYe6SX=OAnNnDRMU6w1Q@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=paulkoning@comcast.net \
    /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).