https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88147
--- Comment #20 from David Malcolm <dmalcolm at gcc dot gnu.org> --- (In reply to David Malcolm from comment #19) > (In reply to David Malcolm from comment #17) > > Created attachment 45660 [details] > > Selftest coverage > > > > The attached reproduces the problem via a minimal selftest, and is also > > fixed by attachment 45653 [details]. > > Thanks for creating this patch. I like that it imposes an upper limit on > the value of a line number within an ordinary linemap relative to the line > map's starting line, but I wonder if that upper limit needs to be lower than > the one in your patch (e.g. what happens if the resulting location_t value > hit limits like LINE_MAP_MAX_LOCATION etc). I constructed a selftest that does that, but it doesn't lead to corrupt location_t values: it hits this check, and returns 0 (aka UNKNOWN_LOCATION): 771 /* Locations of ordinary tokens are always lower than locations of 772 macro tokens. */ 773 if (r >= LINE_MAP_MAX_LOCATION) 774 return 0; So I think your fix is the one we should use. I'm testing a combined patch with your fix + my selftest.