https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97609
--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> --- Created attachment 49460 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49460&action=edit call infer_non_null directly Looking closer at the non-null deref calls, the problem was deep in stmt_ends_bb_p() which cares about trapping statements and such... The general routine looks closely to see if the stmt is the last stmt in a block, and we have no need to do that. This patch is currently in testing, and simply calls infer_nonnull_range() directly. Probably should have been doing that from the start since thats the actual question being asked.