public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	Richard Earnshaw <Richard.Earnshaw@arm.com>,
	James Greenhalgh <James.Greenhalgh@arm.com>,
	Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>, nd <nd@arm.com>,
	richard.sandiford@arm.com
Subject: Re: [PATCH][AArch64] Fix symbol offset limit
Date: Sun, 13 Oct 2019 08:45:00 -0000	[thread overview]
Message-ID: <6a25fa64-5873-45fa-fee6-dbb69787310d@redhat.com> (raw)
In-Reply-To: <mpteezi478o.fsf@arm.com>

On 10/12/19 3:56 AM, Richard Sandiford wrote:
> Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
>> Hi Richard,
>>
>>> If global_char really is a char then isn't that UB?
>>
>> No why?
> 
> Well, "simple expressions like &global_char + 0xffffff00" made it sound
> like there really was a:
> 
>    extern char global_char;
> 
> Only &global_char and &global_char + 1 are defined in that case.
> I was probably taking the example too literally though.
> 
>> We can do all kinds of arithmetic based on pointers, either using
>> pointer types or converted to uintptr_t. Note that the optimizer
>> actually creates these expressions, for example arr[N-x] can be
>> evaluated as (&arr[0] + N) - x.  So this remains legal even if N is
>> well outside the bounds of the array.
> 
> Yeah, true, and I remember valid "x[n - big_offset]" -> invalid
> "x + big_offset - n" being a problem for MIPS too.  It was one of
> the things offset_within_block_p was helping to avoid.
Multiple targets struggle with this.  PA, mn103 also come to mind
immediately.

[ ... ]

> 
> But more importantly, we can't say definitively that code quality isn't
> affected, only that it wasn't affected for the cases we've looked at.
> People could patch the compiler if the new ranges turn out not to strike
> the right balance for their use cases, but not everyone wants to do that.
Absolutely.  IIRC These kinds of addresses are regularly created for
Ada.  Or at least they were.

One of the concepts that really helped the PA from a codegen standpoint
was to distinguish between pointers which we know point into the object
from those which might point outside the object.  Given that knowledge
we could generate more efficient code for the former (particularly WRT
indexed and scaled indexed address modes) and punt the latter.
REGNO_POINTER_FLAG carries this information.

Jeff

  parent reply	other threads:[~2019-10-12 23:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 17:27 Wilco Dijkstra
2019-07-31 17:00 ` Wilco Dijkstra
2019-08-19 15:57   ` Wilco Dijkstra
2019-09-02 12:12     ` Wilco Dijkstra
2019-09-09 17:07       ` Wilco Dijkstra
2019-10-10 17:24         ` Wilco Dijkstra
2019-10-10 18:33           ` Richard Sandiford
2019-10-11 18:31             ` Wilco Dijkstra
2019-10-12 10:20               ` Richard Sandiford
2019-10-12 11:23                 ` Richard Sandiford
2019-10-13  8:45                 ` Jeff Law [this message]
2019-10-14 15:51                 ` Wilco Dijkstra
2019-10-14 16:34                   ` Richard Sandiford
2019-10-15 18:27                     ` Wilco Dijkstra
2019-10-16  8:50                       ` Richard Sandiford
  -- strict thread matches above, loose matches on Subject: below --
2018-11-09 14:47 Wilco Dijkstra
2016-08-23 14:11 Wilco Dijkstra
2016-08-26 10:43 ` Richard Earnshaw (lists)
2016-08-26 19:07   ` Wilco Dijkstra

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=6a25fa64-5873-45fa-fee6-dbb69787310d@redhat.com \
    --to=law@redhat.com \
    --cc=James.Greenhalgh@arm.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.com \
    --cc=richard.sandiford@arm.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).