https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119693
--- Comment #9 from Harald van Dijk <harald at gigawatt dot nl> --- (In reply to Jann Horn from comment #8) > (In reply to Harald van Dijk from comment #7) > > I think implementations have two valid ways of dealing with this: either > > malloc must fail to allocate such a large object, or standard library > > functions must handle such a large object. This could be solved in a 100% > > unambiguously valid way on the glibc side by changing malloc to reject such > > sizes, but on an implementation where malloc supports such sizes, I think > > all of the standard library needs to be prepared to handle that. > > To be clear, I believe glibc malloc rejects object sizes over PTRDIFF_MAX; I > think at least under glibc, you'd have to use a mechanism other than > malloc() to obtain bigger objects: Ah, thanks, if that is the case, and there is no other standards-conforming way of obtaining such an object, then that sounds fine, then there is no issue with GCC assuming such large objects don't exist.