https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>: https://gcc.gnu.org/g:65c1cb358999e9d1618834af341b31837ede839e commit r11-7105-g65c1cb358999e9d1618834af341b31837ede839e Author: David Malcolm <dmalc...@redhat.com> Date: Thu Feb 4 15:20:59 2021 -0500 diagnostics: fix excessive range-printing involving macros [PR97932] PR c/97932 describes a bug in which diagnostic_show_locus prints most of a source file. The issue is that it prints a range in which the start and end locations are part of the same macro map, but the start location is for a token in the definition of the macro, whereas the end location is for a token in an argument of the macro. This patch extends compatible_locations_p to require that range-printing of macro maps requires the location to either be both for the definition of the macro, or both for the arguments of the macro (not one of each), fixing the issue. gcc/ChangeLog: PR c/97932 * diagnostic-show-locus.c (compatible_locations_p): Require locations in the same macro map to be either both from the macro definition, or both from the macro arguments. gcc/testsuite/ChangeLog: PR c/97932 * gcc.dg/pr97932.c: New test.