]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-object-size.cc: Fix assert constant offset in check_for_plus_in_loops [PR122012]
authorLinsen Zhou <i@lin.moe>
Fri, 17 Oct 2025 03:05:04 +0000 (11:05 +0800)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Fri, 24 Oct 2025 10:08:12 +0000 (05:08 -0500)
commitff3e6f43c69ff3ef81daedb9fe7e69b9860b0b5a
tree95e61c87e1e8c6e35dd286b0d407528840f8ead4
parent653977c4a31643497655600688ff238b734f7512
tree-object-size.cc: Fix assert constant offset in check_for_plus_in_loops [PR122012]

After commit 51b85dfeb19652bf3e0aaec08828ba7cee1e641c, when the
pointer offset is a variable in the loop, the object size of the
pointer may also need to be reexamined.
Which make gcc_assert in the check_for_plus_in_loops failed.

gcc/ChangeLog:

PR tree-optimization/122012
* tree-object-size.cc (check_for_plus_in_loops): Skip check
for the variable offset

gcc/testsuite/ChangeLog:

PR tree-optimization/122012
* gcc.dg/torture/pr122012.c: New test.

Signed-off-by: Linsen Zhou <i@lin.moe>
(cherry picked from commit 82cefc4898d4ccabe76e28d6626b91ca9e998923)
gcc/testsuite/gcc.dg/torture/pr122012.c [new file with mode: 0644]
gcc/tree-object-size.cc