https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71831

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
To elaborate on the use case: my immediate need for it is to detect at compile
time possible buffer overflow in calls to sprintf (the -Wformat-length patch)
without _FORTIFY_SOURCE that not all projects use and without optimization. 
The Linux kernel, for example, isn't affected by _FORTIFY_SOURCE because it
defines its own sprintf et at..  Although itdoes obviously benefits from
optimization,  without _FORTIFY_SOURCE inserting calls to
__builtin_object_size, the compute_builtin_object_size function fails just as
it does without optimization.

Another use case is to make -Warray-bounds usable without optimization (bug
67872).  Yet another one is to improve the -Wplacement-new warning.  It seems
that any feature (warning or otherwise) in GCC that needs to compute the size
of an indirectly referenced object could potentially benefit by using the same
function instead of rolling its own.

Beyond GCC itself, I think the feature will be generally more useful when
funcational (in the unambiguous "constant" cases) without optimization.

Reply via email to