https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80221
--- Comment #12 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Mike Stump from comment #6) > The . and .-1, .+1, .-2 forms are fine. The .-62 forms are as problematic > as the original I suspect. I think we should exclude any number greater > than some small int, say, 9. So, .-9 .. .+9 in the new form only. If > outside that range, I think I'd rather punt. The idea is that the absolute > number at least has a line number that in an editor you can go directly to, > and it corresponds with the number in the error messages directly, aiding > understanding which one is referred to without having to ungoop the relative > number first. I've run the script with the range abs(rellinenr) >= 10, and looked at the affected testcases. I found gcc/testsuite/c-c++-common/Wshift-negative-value-1.c, where a dg-error is added on the last line of the test-case, but it seems more suited to be added after the line generating the error. [ Perhaps this adding on last line is a pattern that has been used to avoid the problem of tests starting to fail when adding a line where it's appropriate due to using absolute line numbers. ] I also found gcc/testsuite/objc.dg/try-catch-12.m: ... 12 extern void some_func (int *); 13 14 @implementation TestMyTests 15 - (void) testSpoon { 16 volatile int i = 5; 17 int q = 99; 18 19 do { 20 @try { 21 typeof(i) j = 6; 22 typeof(q) k = 66; 23 some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */ 24 /* { dg-message "but argument is of type" "" { target *-*-* } 12 } */ ... The dg-message on line 24 with line argument 12 refers back to the declaration of some_func. Using the relative line number for this sort of example doesn't make sense, given the large distance there can be between decl and use. But keeping the absolute line number also keeps the problem of tests starting to fail when you add a line at the start. I think this sort of example is better handled with a directive dg-save-linenr: ... 12 extern void some_func (int *); /* { dg-save-linenr some_func_decl } */ 13 14 @implementation TestMyTests 15 - (void) testSpoon { 16 volatile int i = 5; 17 int q = 99; 18 19 do { 20 @try { 21 typeof(i) j = 6; 22 typeof(q) k = 66; 23 some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */ 24 /* { dg-message "but argument is of type" "" { target *-*-* } $some_func_decl } */