]> gcc.gnu.org Git - gcc.git/commit
tree-object-size: Don't let error_mark_node escape for ADDR_EXPR [PR105736]
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Tue, 21 Jun 2022 06:45:07 +0000 (12:15 +0530)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Tue, 21 Jun 2022 06:45:07 +0000 (12:15 +0530)
commit70454c50b4592fe6876ecca13268264e395e058f
tree66e0d9570b3740d06281739bd99eeda1b6ea33c5
parentd6ba321135463edff57b94fa0efc6bc0dd314267
tree-object-size: Don't let error_mark_node escape for ADDR_EXPR [PR105736]

The addr_expr computation does not check for error_mark_node before
returning the size expression.  This used to work in the constant case
because the conversion to uhwi would end up causing it to return
size_unknown, but that won't work for the dynamic case.

Modify the control flow to explicitly return size_unknown if the offset
computation returns an error_mark_node.

gcc/ChangeLog:

PR tree-optimization/105736
* tree-object-size.cc (addr_object_size): Return size_unknown
when object offset computation returns an error.

gcc/testsuite/ChangeLog:

PR tree-optimization/105736
* gcc.dg/builtin-dynamic-object-size-0.c (TV4): New struct.
(val3): New variable.
(test_pr105736): New test.
(main): Call it.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c
gcc/tree-object-size.cc
This page took 0.071136 seconds and 6 git commands to generate.