]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-object-size: Fall back to wholesize for non-const offset
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Thu, 19 Sep 2024 02:36:09 +0000 (22:36 -0400)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Thu, 17 Oct 2024 15:04:10 +0000 (11:04 -0400)
commit51b85dfeb19652bf3e0aaec08828ba7cee1e641c
tree037ed51c9dd196217f13b3c16d940bb8475b8777
parentb12c9ce245204abbd89ac1692b21f16d0ca13583
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 <siddhesh@gotplt.org>
gcc/testsuite/gcc.dg/builtin-object-size-1.c
gcc/tree-object-size.cc