On Sun, Nov 15, 2020 at 1:46 AM Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > GCC considers PTRDIFF_MAX - 1 to be the size of the largest object > so that the difference between a pointer to the byte just past its > end and the first one is no more than PTRDIFF_MAX. This is too > liberal in LP64 on most systems because the size of the address > space is constrained to much less than that, both by the width > of the address bus for physical memory and by the practical > limitations of disk sizes for swap files.
Shouldn't this be a target hook like MAX_OFILE_ALIGNMENT then? > I've been meaning to add a parameter to specify a lower size limit > to help detect more bugs due to excessive sizes in various function > calls (malloc, memcpy, etc.), and also to help better verify that > warnings use the limit correctly. > > Attached is a patch that adds this parameter. Testing it exposed > a few minor bugs in GCC, both in the AWK script that processes > parameter and option files, as well as in the warning code (and > in tests that exercise it). > > Martin