]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-object-size: Always set computed bit for bdos [PR113012]
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Mon, 18 Dec 2023 14:44:00 +0000 (09:44 -0500)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Thu, 11 Jan 2024 13:07:47 +0000 (08:07 -0500)
commitdb86a6009fc83e8cb21cae49c7c55fc2b1186008
treec7baf591573b1dd9f1f6c69ad96bb86a73856f43
parent3e51890ef351e7fb9e836c6a48f20ca97294dc16
tree-object-size: Always set computed bit for bdos [PR113012]

It is always safe to set the computed bit for dynamic object sizes at
the end of collect_object_sizes_for because even in case of a dependency
loop encountered in nested calls, we have an SSA temporary to actually
finish the object size expression.  The reexamine pass for dynamic
object sizes is only for propagation of unknowns and gimplification of
the size expressions, not for loop resolution as in the case of static
object sizes.

gcc/ChangeLog:

PR tree-optimization/113012
* tree-object-size.cc (compute_builtin_object_size): Expand
comment for dynamic object sizes.
(collect_object_sizes_for): Always set COMPUTED bitmap for
dynamic object sizes.

gcc/testsuite/ChangeLog:

PR tree-optimization/113012
* gcc.dg/ubsan/pr113012.c: New test case.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
(cherry picked from commit 576c1fc4401a9dae9757ac2e4fa37d05e130fa3d)
gcc/testsuite/gcc.dg/ubsan/pr113012.c [new file with mode: 0644]
gcc/tree-object-size.cc