public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98892] New: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
@ 2021-01-29 16:44 danglin at gcc dot gnu.org
  2021-06-03 11:19 ` [Bug c/98892] " ebotcazou at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: danglin at gcc dot gnu.org @ 2021-01-29 16:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98892

            Bug ID: 98892
           Summary: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa-unknown-linux-gnu
            Target: hppa-unknown-linux-gnu
             Build: hppa-unknown-linux-gnu

Created attachment 50090
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50090&action=edit
Full test log

Executing on host: /home/dave/gnu/gcc/objdir/gcc/xgcc
-B/home/dave/gnu/gcc/objdir/gcc/
/home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c
   -fdiagnostics-plain-output 
-fplugin=./diagnostic_plugin_test_tree_expression_range.so -O
-fdiagnostics-show-caret -Wno-psabi -S -o diagnostic-test-expressions-1.s   
(timeout = 300)
spawn -ignore SIGHUP /home/dave/gnu/gcc/objdir/gcc/xgcc
-B/home/dave/gnu/gcc/objdir/gcc/
/home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c
-fdiagnostics-plain-output
-fplugin=./diagnostic_plugin_test_tree_expression_range.so -O
-fdiagnostics-show-caret -Wno-psabi -S -o diagnostic-test-expressions-1.s
FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
-fplugin=./diagnostic_plugin_test_tree_expression_range.so  expected multiline
pattern lines 550-551 not found: "                           
__builtin_types_compatible_p \(long, int\) \+ f \(i\)\);.*\n                   
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\^~~~~~~\n"
FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
-fplugin=./diagnostic_plugin_test_tree_expression_range.so (test for excess
errors)
Excess errors:
                           __builtin_types_compatible_p (long, int) + f (i));
/* { dg-warning "range" } */
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/98892] FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
  2021-01-29 16:44 [Bug c/98892] New: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c danglin at gcc dot gnu.org
@ 2021-06-03 11:19 ` ebotcazou at gcc dot gnu.org
  2021-06-26  4:09 ` wilson at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-06-03 11:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98892

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|hppa-unknown-linux-gnu      |
   Last reconfirmed|                            |2021-06-03
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ebotcazou at gcc dot gnu.org
              Build|hppa-unknown-linux-gnu      |
             Target|hppa-unknown-linux-gnu      |

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I'm seeing it on x86-64/Linux as well:

FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
-fplugin=./diagnostic_plugin_test_tree_expression_range.so  1 blank line(s) in
output
FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
-fplugin=./diagnostic_plugin_test_tree_expression_range.so  expected multiline
pattern lines 550-551 not found: "                           
__builtin_types_compatible_p \\(long, int\\) \\+ f \\(i\\)\\);.*\\n            
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\^~~~~~~\\n"
FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
-fplugin=./diagnostic_plugin_test_tree_expression_range.so (test for excess
errors)

but it apparently goes away and comes back.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/98892] FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
  2021-01-29 16:44 [Bug c/98892] New: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c 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
  2021-06-26 14:46 ` wilson at gcc dot gnu.org
  2021-06-28 17:27 ` wilson at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-06-26  4:09 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/98892] FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
  2021-01-29 16:44 [Bug c/98892] New: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c 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
@ 2021-06-26 14:46 ` wilson at gcc dot gnu.org
  2021-06-28 17:27 ` wilson at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-06-26 14:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98892

--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> ---
On second thought, I don't think that there is anything wrong with
dg-*-multiline-output.

The problem is simply that the diagnostic code is left shifting the error
message by m_x_offset_display, and this left shit causes the printed message to
not match the expected message.  The difference is only a few chars of white
space which makes it very hard to see the problem when inspecting the test log.
 You have to count white space characters to see the problem.  In my case,
there is one less space char in the printed message than in the expected
message.

And it looks like the solution is -fmessage-length=0 which is already added to
ALWAYS_CXXFLAGS and should maybe be added to ALWAYS_TEST_FLAGS instead.  Or
maybe just added to this one testcase for now to make it work.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/98892] FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c
  2021-01-29 16:44 [Bug c/98892] New: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c danglin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-06-26 14:46 ` wilson at gcc dot gnu.org
@ 2021-06-28 17:27 ` wilson at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-06-28 17:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98892

--- Comment #4 from Jim Wilson <wilson at gcc dot gnu.org> ---
It turns out that -fmessage-length=0 doesn't work which is odd.  I suspect a
latent bug in the diagnostic code.

I tried -fmessage-length=128, which should work as that is longer than the
error line, and does work for this failure, but that causes a different line to
fail.  Turns out that there is a test that emits a 2.3KB error message.  To
make the entire testcase work, I need a -fmessage-length value longer than the
longest error message, so the smallest power of 2 that works is
-fmessage-length=4096 which seems too stupid to submit as a patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-28 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-29 16:44 [Bug c/98892] New: FAIL: gcc.dg/plugin/diagnostic-test-expressions-1.c 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
2021-06-26 14:46 ` wilson at gcc dot gnu.org
2021-06-28 17:27 ` wilson at gcc dot gnu.org

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).