https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110830
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Benjamin Priour <vultk...@gcc.gnu.org>: https://gcc.gnu.org/g:7d2274b9e346f44f8f6598b9dbb9fa95259274a2 commit r14-3794-g7d2274b9e346f44f8f6598b9dbb9fa95259274a2 Author: benjamin priour <vultk...@gcc.gnu.org> Date: Fri Sep 1 20:21:41 2023 +0200 analyzer: Call off a superseding when diagnostics are unrelated [PR110830] Before this patch, a saved_diagnostic would supersede another at the same statement if and only its vfunc supercedes_p returned true for the other diagnostic's kind. That both warning were unrelated - i.e. resolving one would not fix the other - was not considered in making the above choice. This patch makes it so that two saved_diagnostics taking a different outcome of at least one common conditional branching cannot supersede each other. Signed-off-by: Benjamin Priour <vultk...@gcc.gnu.org> Co-authored-by: David Malcolm <dmalc...@redhat.com> Signed-off-by: David Malcolm <dmalc...@redhat.com> gcc/analyzer/ChangeLog: PR analyzer/110830 * diagnostic-manager.cc (compatible_epaths_p): New function. (saved_diagnostic::supercedes_p): Now calls the above to determine if the diagnostics do overlap and the superseding may proceed. gcc/testsuite/ChangeLog: PR analyzer/110830 * c-c++-common/analyzer/pr110830.c: New test.