[llvm-dev] problems with objects larger than PTRDIFF_MAX
John Regehr via llvm-dev
llvm-dev at lists.llvm.org
Sat May 21 12:06:40 PDT 2016
I agree, LLVM is not obligated to support objects larger than
PTRDIFF_MAX bytes.
A reasonable and friendly goal would be to document this constraint and
perhaps also arrange for some compile-time warnings and/or runtime
errors to be emitted when it is violated.
John
On 5/20/16 6:58 PM, David Majnemer via llvm-dev wrote:
> I've come across this issue before and came to the following conclusion:
> - We are not obligated to support objects that large, C11 5.2.4.1/1
> <http://5.2.4.1/1> only requires that we support objects of size 65535!
> Their guidance for maximum object size is stated to be half of SIZE_MAX
> in C11 K.3.4/4 which is typically equivalent to PTRDIFF_MAX.
> - The expectation that PTRDIFF_MAX is more or less a proxy for the
> largest object size is not uncommon. For example, C++'s std::count
> doesn't return a size_t but a iterator_traits<>::difference_type which
> is going to be a ptrdiff_t for things like std::vector.
>
> On Fri, May 20, 2016 at 1:31 AM, John Regehr via llvm-dev
> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>
> It could be that 32-bit systems are disappearing so rapidly that
> nobody cares too much about this issue, but this blog post is still
> worth reading:
>
> http://trust-in-soft.com/objects-larger-than-ptrdiff_max-bytes/
>
> John
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
More information about the llvm-dev
mailing list