public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilson at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/98892] FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
Date: Sat, 26 Jun 2021 04:09:10 +0000	[thread overview]
Message-ID: <bug-98892-4-gzZDX4pryB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98892-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2021-06-26  4:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 16:44 [Bug c/98892] New: " danglin at gcc dot gnu.org
2021-06-03 11:19 ` [Bug c/98892] " ebotcazou at gcc dot gnu.org
2021-06-26  4:09 ` wilson at gcc dot gnu.org [this message]
2021-06-26 14:46 ` wilson at gcc dot gnu.org
2021-06-28 17:27 ` wilson at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98892-4-gzZDX4pryB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).