[llvm-dev] problems with objects larger than PTRDIFF_MAX

David Majnemer via llvm-dev llvm-dev at lists.llvm.org
Fri May 20 09:58:42 PDT 2016


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 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> 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
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160520/dc228a9e/attachment.html>


More information about the llvm-dev mailing list