https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103132
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Martin Jambor <jamb...@gcc.gnu.org>: https://gcc.gnu.org/g:df8690f28379795a44aa4b6c737df08828168b6a commit r12-5045-gdf8690f28379795a44aa4b6c737df08828168b6a Author: Martin Jambor <mjam...@suse.cz> Date: Tue Nov 9 11:32:20 2021 +0100 ipa: Fix segfault when remapping debug_binds with expressions (PR 103132) My initial implementation of the method ipa_param_body_adjustments::remap_with_debug_expressions was based on the assumption that if it was asked to remap an expression (as opposed to a simple SSA_NAME), the expression would not contain an SSA_NAME operand which is to be debug-reset. While that is true for when called from ipa_param_body_adjustments::prepare_debug_expressions, it turns out it is not true when invoked from remap_gimple_stmt in tree-inline.c. This patch adds a simple logic to handle such cases and simply map the entire value to NULL_TREE in those cases. gcc/ChangeLog: 2021-11-08 Martin Jambor <mjam...@suse.cz> PR ipa/103132 * ipa-param-manipulation.c (replace_with_mapped_expr): Early return with error_mark_mode when part of expression is mapped to NULL. (ipa_param_body_adjustments::remap_with_debug_expressions): Set mapped value to NULL if walk_tree returns error_mark_mode. gcc/testsuite/ChangeLog: 2021-11-08 Martin Jambor <mjam...@suse.cz> PR ipa/103132 * gcc.dg/ipa/pr103132.c: New test.