https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102908
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:7518e4c2f0758daac5d650d400565cf49ac3c8c5 commit r12-4661-g7518e4c2f0758daac5d650d400565cf49ac3c8c5 Author: Andrew Pinski <apin...@marvell.com> Date: Sat Oct 23 19:24:43 2021 +0000 Fix PR 102908: wrongly removing null pointer loads Just like PR 100382, here we have a DCE removing a null pointer load which is needed still. In this case, execute_fixup_cfg removes a store (correctly) and then removes the null load (incorrectly) due to not checking stmt_unremovable_because_of_non_call_eh_p. This patch adds the check in the similar way as the patch to fix PR 100382 did. gcc/ChangeLog: * tree-ssa-dce.c (simple_dce_from_worklist): Check stmt_unremovable_because_of_non_call_eh_p also before removing the statement.