https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98892
Jim Wilson <wilson at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu.org --- Comment #2 from Jim Wilson <wilson at gcc dot gnu.org> --- I ran into this with a riscv toolchain make check. Debugging, I discovered that if my terminal window is 80 characters wide, then context->max_caret_width gets set to 78 in diagnostic.c, and then in diagnostic-show-locus.c m_x_offset_display gets set to 9, and then in print_trailing_fixits it calls move_to_column with column set to 9 which causes an extra unnecessary newline to be emitted. This extra newline leads to the "1 blank lines in output" error. Also, I suspect that there is a contributing bug in the dg-{begin,end}-multiline-output support that causes it to fail when an error is followed by two newlines. This causes the "expected multiline pattern lines 550-551" failure. A bit of experimenting with the testcase in isolation shows that if my screen is 88 chars wide there is no extra newline, and if my screen is 87 chars wide I get the extra newline. A bit of experimenting with RUNTESTFLAGS="plugin.exp" show that the testcase fails every time when my screen is 80 characters wide and works everytime when my screen is 81 characters wide. I don't know why this number is different than above. A testcase whose success depends on screen width is very annoying. One way to work around the problem is to make the line shorter. If I delete one tab char from line 548 of gcc.dg/plugin/diagnostic-test-expressions-1.c and 8 space characters from the two matching error lines 550 and 551, then the testcase does work with an 80 character wide terminal. However, it does now fail with a 77 char wide screen due to a different line 415-416. So this isn't an ideal solution. But it works for me as my screens are always 80 characters wide. ideally there should be a way to turn off the max_caret_width stuff when running the testsuite so results don't depend on screen width. Someone who knows the diagnostic code should probably look at this. Or maybe print_trailing_fixits can be fixed? It isn't obvious why it needs to call move_to_column at the end.