https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77608
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Siddhesh Poyarekar <siddh...@gcc.gnu.org>: https://gcc.gnu.org/g:51b85dfeb19652bf3e0aaec08828ba7cee1e641c commit r15-4414-g51b85dfeb19652bf3e0aaec08828ba7cee1e641c Author: Siddhesh Poyarekar <siddh...@gotplt.org> Date: Wed Sep 18 22:36:09 2024 -0400 tree-object-size: Fall back to wholesize for non-const offset Don't bail out early if the offset to a pointer in __builtin_object_size is a variable, return the wholesize instead since that is a better fallback for maximum estimate. This should keep checks in place for fortified functions to constrain overflows to at lesat some extent. gcc/ChangeLog: PR middle-end/77608 * tree-object-size.cc (plus_stmt_object_size): Drop check for constant offset. gcc/testsuite/ChangeLog: * gcc.dg/builtin-object-size-1.c (test12): New test. (main): Call it. Signed-off-by: Siddhesh Poyarekar <siddh...@gotplt.org>