From: Jonathan Wakely <jwakely@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org>,
Jan Hubicka <hubicka@ucw.cz>, Jakub Jelinek <jakub@redhat.com>,
"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [libstdc++] Improve M_check_len
Date: Tue, 20 Jun 2023 11:50:28 +0100 [thread overview]
Message-ID: <CACb0b4n-FLdwVRZs3VzOYaCyE4tDHwpNwfEPDr7MTwHndKcQrg@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4=VeTb9WyP-Su0PWYEQj_9240T_2U-QLGRQKU0kz7SZVg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
On Tue, 20 Jun 2023 at 11:45, Jonathan Wakely <jwakely@redhat.com> wrote:
> On Tue, 20 Jun 2023 at 09:21, Andreas Schwab wrote:
>
>> On Jun 20 2023, Jakub Jelinek via Gcc-patches wrote:
>>
>> > Is it safe even on 64bit targets? I mean, doesn't say PowerPC already
>> allow
>> > full 64-bit virtual address space? The assumption that one can't have
>> > more than half of virtual address space allocations is true right now at
>> > least on x86-64, aarch64 and others, but isn't that something that can
>> > change with newer versions of CPUs without the need to recompile
>> > applications (add another level or two of page tables)?
>>
>> At least s390 can allocate more than half the address space. That
>> triggered a failure in gawk.
>>
>
> Is PTRDIFF_MAX large enough to represent the difference between any two
> pointers?
>
> What we're considering for libstdc++ is treating PTRDIFF_MAX as an upper
> limit on allocation size. If there are targets that can really allocate a
> 2^63 byte array, they won't be able to represent the difference between the
> first element and the last element unless ptrdiff_t is wider than 64 bits.
>
Of course if we're talking about 32-bit targets then you only need a 64-bit
ptrdiff_t to allow arrays larger than 2^31 bytes. In any case, PTRDIFF_MAX
is still an upper limit (although for a 64-bit ptrdiff_t and a 32-bit
address space, it's not a useful limit, because it's much much larger than
the real limit).
next prev parent reply other threads:[~2023-06-20 10:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-18 18:27 Jan Hubicka
2023-06-19 10:12 ` Jonathan Wakely
2023-06-19 11:05 ` Jan Hubicka
2023-06-19 11:20 ` Jakub Jelinek
2023-06-19 15:13 ` Jonathan Wakely
2023-06-19 15:14 ` Jonathan Wakely
2023-06-19 15:35 ` Jonathan Wakely
2023-06-20 7:50 ` Jan Hubicka
2023-06-20 8:05 ` Jan Hubicka
2023-06-20 8:07 ` Jakub Jelinek
2023-06-20 8:21 ` Andreas Schwab
2023-06-20 10:45 ` Jonathan Wakely
2023-06-20 10:50 ` Jonathan Wakely [this message]
2023-06-19 16:14 ` Jan Hubicka
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=CACb0b4n-FLdwVRZs3VzOYaCyE4tDHwpNwfEPDr7MTwHndKcQrg@mail.gmail.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=jakub@redhat.com \
--cc=libstdc++@gcc.gnu.org \
--cc=schwab@suse.de \
/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).