public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: "Martin Liška" <mliska@suse.cz>,
	"Richard Biener" <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH 1/3] vec: add exact argument for various grow functions.
Date: Thu, 27 Aug 2020 17:29:24 -0600	[thread overview]
Message-ID: <4db2cb8f-b9d1-6fda-aa2c-57e16f5bfb61@gmail.com> (raw)
In-Reply-To: <8b288cef-fa2a-3a64-1f19-927ad5742f97@suse.cz>

With --enable-valgrind-annotations the change to the member function
signature in this patch triggers compilation errors during bootstrap:

/src/gcc/trunk/gcc/ggc-common.c: In function ‘void gt_pch_save(FILE*)’:
/src/gcc/trunk/gcc/ggc-common.c:509:33: error: no matching function for 
call to ‘vec<char>::safe_grow(size_t&)’
       vbits.safe_grow (valid_size);
                                  ^
In file included from /src/gcc/trunk/gcc/hash-table.h:248,
                  from /src/gcc/trunk/gcc/coretypes.h:476,
                  from /src/gcc/trunk/gcc/ggc-common.c:26:
/src/gcc/trunk/gcc/vec.h:1897:1: note: candidate: ‘void 
vec<T>::safe_grow(unsigned int, bool) [with T = char]’
  vec<T, va_heap, vl_ptr>::safe_grow (unsigned len, bool exact 
MEM_STAT_DECL)
  ^~~~~~~~~~~~~~~~~~~~~~~
/src/gcc/trunk/gcc/vec.h:1897:1: note:   candidate expects 2 arguments, 
1 provided

/src/gcc/trunk/gcc/jit/jit-recording.c: In member function ‘virtual 
gcc::jit::recording::string* 
gcc::jit::recording::switch_::make_debug_string()’:
/src/gcc/trunk/gcc/jit/jit-recording.c:6313:41: error: no matching 
function for call to ‘auto_vec<char>::safe_grow(size_t)’
  6313 |       cases_str.safe_grow (idx + 1 + len);
       |                                         ^
In file included from /src/gcc/trunk/gcc/hash-table.h:248,
                  from /src/gcc/trunk/gcc/coretypes.h:476,
                  from /src/gcc/trunk/gcc/jit/jit-recording.c:23:
/src/gcc/trunk/gcc/vec.h:1897:1: note: candidate: ‘void 
vec<T>::safe_grow(unsigned int, bool) [with T = char]’
  1897 | vec<T, va_heap, vl_ptr>::safe_grow (unsigned len, bool exact 
MEM_STAT_DECL)
       | ^~~~~~~~~~~~~~~~~~~~~~~
/src/gcc/trunk/gcc/vec.h:1897:1: note:   candidate expects 2 arguments, 
1 provided


Bootstrap succeeds with the patch below:

diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 0d528cf455c..d4691cc5448 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -506,7 +506,7 @@ gt_pch_save (FILE *f)
        if (__builtin_expect (RUNNING_ON_VALGRIND, 0))
  	{
  	  if (vbits.length () < valid_size)
-	    vbits.safe_grow (valid_size);
+	    vbits.safe_grow (valid_size, true);
  	  get_vbits = VALGRIND_GET_VBITS (state.ptrs[i]->obj,
  					  vbits.address (), valid_size);
  	  if (get_vbits == 3)
diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
index b73cd76a0a0..a9e6528db69 100644
--- a/gcc/jit/jit-recording.c
+++ b/gcc/jit/jit-recording.c
@@ -6310,7 +6310,7 @@ recording::switch_::make_debug_string ()
      {
        size_t len = strlen (c->get_debug_string ());
        unsigned idx = cases_str.length ();
-      cases_str.safe_grow (idx + 1 + len);
+      cases_str.safe_grow (idx + 1 + len, true);
        cases_str[idx] = ' ';
        memcpy (&(cases_str[idx + 1]),
  	      c->get_debug_string (),

Martin

  reply	other threads:[~2020-08-27 23:29 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-25 12:22 [PATCH] Use vec::reserve before vec_safe_grow_cleared is called Martin Liška
2020-07-27  7:11 ` Richard Biener
2020-07-27  7:14   ` Martin Liška
2020-07-27  9:51     ` Jan Hubicka
2020-07-27 10:29       ` Martin Liška
2020-07-27 10:48         ` Jan Hubicka
2020-07-27 11:00           ` Martin Liška
2020-07-27 11:03             ` Jan Hubicka
2020-07-27 11:22               ` Martin Liška
2020-07-27 12:49                 ` Andreas Schwab
2020-07-27 12:51                   ` Richard Biener
2020-07-27 12:54                     ` Martin Liška
2020-07-27 12:58                       ` Richard Biener
2020-07-27 11:07           ` Richard Biener
2020-07-27 11:11     ` Jan Hubicka
2020-07-27 11:24       ` Martin Liška
2020-07-27 11:31         ` Richard Biener
2020-07-28 10:23           ` [PATCH] Use exact=false for vec_safe_grow{,_cleared} functions Martin Liška
2020-07-29 13:47             ` Richard Biener
2020-07-30 13:22               ` Martin Liška
2020-08-03 13:47                 ` Richard Biener
2020-08-11 11:36                   ` [PATCH 1/3] vec: add exact argument for various grow functions Martin Liška
2020-08-11 11:37                     ` [PATCH 2/3] vec: default exact = false in " Martin Liška
2020-08-26 21:00                       ` Jeff Law
2020-08-11 11:37                     ` [PATCH 3/3] vec: use inexact growth where possible Martin Liška
2020-08-26 21:02                       ` Jeff Law
2020-08-27  8:54                         ` Richard Biener
2020-09-01 11:25                           ` Martin Liška
2020-09-01 13:00                             ` Richard Biener
2020-08-11 14:58                     ` [PATCH 1/3] vec: add exact argument for various grow functions Martin Sebor
2020-08-12 12:28                       ` Martin Liška
2020-08-13  0:18                         ` Martin Sebor
2020-08-26 13:54                         ` Martin Liška
2020-08-27 23:29                           ` Martin Sebor [this message]
2020-08-28  6:49                             ` Martin Liška
2020-08-28 14:35                               ` Martin Sebor
2020-08-26 20:59                     ` Jeff Law
2020-08-28 14:24                     ` Andrew Stubbs
2020-08-28 14:26                       ` Martin Liška
2020-08-28 14:44                         ` Andrew Stubbs

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=4db2cb8f-b9d1-6fda-aa2c-57e16f5bfb61@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.com \
    /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).