This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 06 Nov 2015 13:55:26 +0100
- Subject: Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow
- Authentication-results: sourceware.org; auth=none
- References: <561D3DEC dot 5090209 at gmail dot com> <5626D4D0 dot 4010603 at gmail dot com> <562ED7E4 dot 8030001 at gmail dot com> <56381EB8 dot 4090708 at redhat dot com> <563A3C45 dot 1060907 at gmail dot com> <563A58AB dot 608 at redhat dot com> <563A9FAD dot 2050807 at gmail dot com> <563ADAA2 dot 9090702 at redhat dot com> <563B71F5 dot 8030902 at gmail dot com> <563B7541 dot 3010902 at redhat dot com> <563B8953 dot 20901 at gmail dot com>
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:
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),
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University