https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105736
--- Comment #4 from CVS 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:70454c50b4592fe6876ecca13268264e395e058f commit r13-1183-g70454c50b4592fe6876ecca13268264e395e058f Author: Siddhesh Poyarekar <siddh...@gotplt.org> Date: Tue Jun 21 12:15:07 2022 +0530 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 <siddh...@gotplt.org>