public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/106782] New: dump_printf_loc has incorrect format attribute
Date: Wed, 31 Aug 2022 08:42:40 +0000	[thread overview]
Message-ID: <bug-106782-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 106782
           Summary: dump_printf_loc has incorrect format attribute
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

We don't perform -Wformat checks on dump_printf_loc calls because it pretends
it has a va_list argument instead of ... at the end:
--- gcc/dumpfile.h.jj   2022-01-18 11:58:59.501983213 +0100
+++ gcc/dumpfile.h      2022-08-31 10:36:25.789850981 +0200
@@ -574,7 +574,7 @@ extern void dump_printf (const dump_meta

 extern void dump_printf_loc (const dump_metadata_t &, const
dump_user_location_t &,
                             const char *, ...)
-  ATTRIBUTE_GCC_DUMP_PRINTF (3, 0);
+  ATTRIBUTE_GCC_DUMP_PRINTF (3, 4);
 extern void dump_function (int phase, tree fn);
 extern void dump_basic_block (dump_flags_t, basic_block, int);
 extern void dump_generic_expr_loc (const dump_metadata_t &,
Unfortunately this patch results in tons of warnings that should be fixed one
way or another.  E.g.:
../../gcc/tree-vect-slp.cc: In function ‘void vect_print_slp_tree(dump_flags_t,
dump_location_t, slp_tree)’:
../../gcc/tree-vect-slp.cc:2528:49: warning: format ‘%p’ expects argument of
type ‘void*’, but argument 5 has type ‘slp_tree’ {aka ‘_slp_tree*’} [-Wformat=]
 2528 |   dump_printf_loc (metadata, user_loc, "node%s %p (max_nunits=%u,
refcnt=%u)",
      |                                                ~^
      |                                                 |
      |                                                 void*
......
 2533 |                       : ""), node,
      |                              ~~~~                
      |                              |
      |                              slp_tree {aka _slp_tree*}
../../gcc/tree-vect-slp.cc:2528:64: warning: format ‘%u’ expects argument of
type ‘unsigned int’, but argument 6 has type ‘long int’ [-Wformat=]
 2528 |   dump_printf_loc (metadata, user_loc, "node%s %p (max_nunits=%u,
refcnt=%u)",
      |                                                               ~^
      |                                                                |
      |                                                                unsigned
int
      |                                                               %lu
......
 2534 |                    estimated_poly_value (node->max_nunits),
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      
      |                                         |
      |                                         long int

             reply	other threads:[~2022-08-31  8:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  8:42 jakub at gcc dot gnu.org [this message]
2022-08-31 12:16 ` [Bug other/106782] " rguenth at gcc dot gnu.org
2022-08-31 16:22 ` jakub at gcc dot gnu.org
2022-08-31 16:24 ` jakub at gcc dot gnu.org
2022-08-31 16:42 ` tnfchris at gcc dot gnu.org
2022-09-01  9:08 ` cvs-commit at gcc dot gnu.org
2022-09-01  9:41 ` cvs-commit at gcc dot gnu.org
2022-09-01  9:43 ` jakub at gcc dot gnu.org
2022-09-01 21:05 ` cvs-commit at gcc dot gnu.org
2022-09-02  8:23 ` cvs-commit 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-106782-4@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).