[PATCH 0/12] detect quoting and punctuation problems in diagnostics

Martin Sebor msebor@gmail.com
Thu May 16 15:01:00 GMT 2019


On 5/16/19 4:02 AM, Martin Liška wrote:
> Hi.
> 
> Maybe I've install the patches wrongly, but I see following error on ppc64le
> during bootstrap in stage2:

I also noticed it yesterday on x86_64.  The %qk was vestige of
an earlier attempt to use the pretty-printer to format TREE_CODEs.
I have this in my tree that fixes it but let me post an updated
patch.

--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10009,8 +10009,10 @@ void
  omp_clause_check_failed (const_tree node, const char *file, int line,
                           const char *function, enum omp_clause_code code)
  {
-  internal_error ("tree check: expected omp_clause %s, have %s in %s, 
at %s:%d",
-                 omp_clause_code_name[code], get_tree_code_name 
(TREE_CODE (node)),
+  internal_error ("tree check: expected %<omp_clause %s%>, have %qs "
+                 "in %s, at %s:%d",
+                 omp_clause_code_name[code],
+                 get_tree_code_name (TREE_CODE (node)),
                   function, trim_filename (file), line);
  }


As a heads up, my latest log still shows a few testsuite failures
that I need to clean up. Those I've looked at are all missing
adjustments to expected dg-warning output.

!  FAIL: 20_util/any/misc/any_cast_neg.cc (3: +3)
!  FAIL: gcc.dg/gcc_diag-11.c (1: +1)
!  FAIL: g++.dg/ubsan/pr63956.C (21: +21)
!  FAIL: gnat.dg/inline3.adb (2: +2)
!  FAIL: gnat.dg/inline5.adb (2: +2)
!  FAIL: gnat.dg/inline7.adb (2: +2)
!  FAIL: gnat.dg/inline9.adb (2: +2)
!  FAIL: objc.dg/method-19.m (2: +2)
!  FAIL: objc.dg/protocol-qualifier-2.m (2: +2)
!  FAIL: obj-c++.dg/protocol-qualifier-2.mm (2: +2)

Martin

> 
> /home/marxin/Programming/gcc/objdir/./prev-gcc/xg++ -B/home/marxin/Programming/gcc/objdir/./prev-gcc/ -B/usr/local/powerpc64le-unknown-linux-gnu/bin/ -nostdinc++ -B/home/marxin/Programming/gcc/objdir/prev-powerpc64le-unknn-linux-gnu/libstdc++-v3/src/.libs -B/home/marxin/Programming/gcc/objdir/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/home/marxin/Programming/gcc/objdir/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/include/powerpc64le-unknown-linux-gnu  -I/homearxin/Programming/gcc/objdir/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/include  -I/home/marxin/Programming/gcc/libstdc++-v3/libsupc++ -L/home/marxin/Programming/gcc/objdir/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/marxin/Programming/gcc/objr/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c   -g -O2 -fno-checking -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include  -I../../gcc/../libdecnumber -I../../gcc/../libcnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace   -o tree.o -MT tree.o -MMD -MP -MF ./.deps/tree.TPo ../../gcc/tree.c
> ../../gcc/tree.c: In function ‘void omp_clause_check_failed(const_tree, const char*, int, const char*, omp_clause_code)’:
> ../../gcc/tree.c:10012:67: error: unknown conversion type character ‘k’ in format [-Werror=format=]
> 10012 |   internal_error ("tree check: expected %<omp_clause %s%>, have %qk "
>        |                                                                   ^
> ../../gcc/tree.c:10013:10: error: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘int’ [-Werror=format=]
> 10013 |     "in %s, at %s:%d",
>        |         ~^
>        |          |
>        |          char*
>        |         %d
> ../../gcc/tree.c:10013:20: error: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘const char*’ [-Werror=format=]
> 10013 |     "in %s, at %s:%d",
>        |                   ~^
>        |                    |
>        |                    int
>        |                   %s
> 10014 |     omp_clause_code_name[code], TREE_CODE (node),
> 10015 |     function, trim_filename (file), line);
>        |               ~~~~~~~~~~~~~~~~~~~~
>        |                             |
>        |                             const char*
> ../../gcc/tree.c:10012:19: error: too many arguments for format [-Werror=format-extra-args]
> 10012 |   internal_error ("tree check: expected %<omp_clause %s%>, have %qk "
>        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 10013 |     "in %s, at %s:%d",
>        |     ~~~~~~~~~~~~~~~~~
> 
> Martin
> 



More information about the Gcc-patches mailing list