public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Martin Sebor <msebor@gmail.com>
Cc: Jason Merrill <jason@redhat.com>,
	 Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow
Date: Fri, 06 Nov 2015 12:55:00 -0000	[thread overview]
Message-ID: <yddoaf7479d.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <563B8953.20901@gmail.com> (Martin Sebor's message of "Thu, 05	Nov 2015 09:52:35 -0700")

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Martin Sebor <msebor@gmail.com> writes:

>> If we use gcc_checking_assert it won't fire in release builds; let's go
>> with that.
>
> Okay. Attached is an updated patch with that change.

Unfortunately, this breaks i386-pc-solaris2.10 bootstrap:

/vol/gcc/src/hg/trunk/local/gcc/cp/init.c: In function 'void warn_placement_new_too_small(tree, tree, tree, tree)':
/vol/gcc/src/hg/trunk/local/gcc/cp/init.c:2454:17: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'long long unsigned int' [-Werror=format=]
      bytes_avail);
                 ^

Printing an unsigned HOST_WIDE_INT with %lu in one case, but %wu in the
other seems like a simple typo, so the following fixes bootstrap for me:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cp-init.patch --]
[-- Type: text/x-patch, Size: 505 bytes --]

diff --git a/gcc/cp/init.c b/gcc/cp/init.c
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2447,7 +2447,7 @@ warn_placement_new_too_small (tree type,
 			  "%<%T [%wu]%> and size %qwu in a region of type %qT "
 			  "and size %qwi"
 			  : "placement new constructing an object of type "
-			  "%<%T [%lu]%> and size %qwu in a region of type %qT "
+			  "%<%T [%wu]%> and size %qwu in a region of type %qT "
 			  "and size at most %qwu",
 			  type, tree_to_uhwi (nelts), bytes_need,
 			  TREE_TYPE (oper),

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]


	Rainer


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

  parent reply	other threads:[~2015-11-06 12:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 17:23 Martin Sebor
2015-10-21  0:03 ` [PING] " Martin Sebor
2015-10-27  2:07   ` [PING 2] " Martin Sebor
2015-11-03  2:41     ` Jason Merrill
2015-11-04 17:12       ` Martin Sebor
2015-11-04 19:12         ` Jason Merrill
2015-11-05  0:15           ` Martin Sebor
2015-11-05  4:27             ` Jason Merrill
2015-11-05 15:13               ` Martin Sebor
2015-11-05 15:27                 ` Jason Merrill
2015-11-05 16:52                   ` Martin Sebor
2015-11-05 18:13                     ` Jason Merrill
2015-11-05 23:41                       ` Martin Sebor
2015-11-06  1:10                         ` Martin Sebor
2015-11-06 12:50                     ` Andreas Schwab
2015-11-08 18:10                       ` Martin Sebor
2015-11-06 12:55                     ` Rainer Orth [this message]
2015-11-06 15:28                       ` Martin Sebor

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=yddoaf7479d.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=msebor@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).