Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-08 Thread Martin Sebor
On 11/06/2015 05:50 AM, Andreas Schwab wrote: I see this failure on m68k: FAIL: g++.dg/warn/Wplacement-new-size.C -std=gnu++11 (test for excess errors) Excess errors: /daten/aranym/gcc/gcc-20151106/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C:189:19: warning: placement new constructing an

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-06 Thread Martin Sebor
On 11/06/2015 05:55 AM, Rainer Orth wrote: Martin Sebor 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:

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-06 Thread Andreas Schwab
I see this failure on m68k: FAIL: g++.dg/warn/Wplacement-new-size.C -std=gnu++11 (test for excess errors) Excess errors: /daten/aranym/gcc/gcc-20151106/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C:189:19: warning: placement new constructing an object of type 'int' and size '4' in a region

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-06 Thread Rainer Orth
Martin Sebor 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

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-05 Thread Martin Sebor
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. Martin gcc ChangeLog 2015-11-05 Martin Sebor PR c++/67942 * invoke.texi (-Wplacement-new): Document new option. *

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-05 Thread Jason Merrill
OK, thanks. Jason

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-05 Thread Martin Sebor
On 11/05/2015 11:13 AM, Jason Merrill wrote: OK, thanks. I'm afraid the last patch that I just committed breaks libstdc++ bootstrap with the following error: /home/msebor/scm/fsf/gcc-svn/libstdc++-v3/src/c++98/ios_init.cc: In static member function ‘static bool

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-05 Thread Martin Sebor
On 11/05/2015 04:41 PM, Martin Sebor wrote: On 11/05/2015 11:13 AM, Jason Merrill wrote: OK, thanks. I'm afraid the last patch that I just committed breaks libstdc++ bootstrap with the following error: I committed a slightly more robust fix that avoids assuming that either the size of the

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-05 Thread Jason Merrill
On 11/05/2015 10:12 AM, Martin Sebor wrote: On 11/04/2015 09:27 PM, Jason Merrill wrote: On 11/04/2015 07:15 PM, Martin Sebor wrote: There was a lot of discussion of C++ aliasing rules at the recent meeting; we really seem to be moving in the direction of being stricter about which union

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-05 Thread Martin Sebor
On 11/04/2015 09:27 PM, Jason Merrill wrote: On 11/04/2015 07:15 PM, Martin Sebor wrote: There was a lot of discussion of C++ aliasing rules at the recent meeting; we really seem to be moving in the direction of being stricter about which union member is active. So I think we do want to

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-04 Thread Martin Sebor
There was a lot of discussion of C++ aliasing rules at the recent meeting; we really seem to be moving in the direction of being stricter about which union member is active. So I think we do want to diagnose the new-expression above; the user should write new () if that's what they mean. Okay.

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-04 Thread Jason Merrill
On 11/04/2015 07:15 PM, Martin Sebor wrote: There was a lot of discussion of C++ aliasing rules at the recent meeting; we really seem to be moving in the direction of being stricter about which union member is active. So I think we do want to diagnose the new-expression above; the user should

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-04 Thread Jason Merrill
On 11/04/2015 12:11 PM, Martin Sebor wrote: On 11/02/2015 07:40 PM, Jason Merrill wrote: On 10/26/2015 09:48 PM, Martin Sebor wrote: + while (TREE_CODE (oper) == NOP_EXPR) +oper = TREE_OPERAND (oper, 0); This is STRIP_NOPS. + to placement new is not checked since it's unknownwhat

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-04 Thread Martin Sebor
On 11/02/2015 07:40 PM, Jason Merrill wrote: On 10/26/2015 09:48 PM, Martin Sebor wrote: + while (TREE_CODE (oper) == NOP_EXPR) +oper = TREE_OPERAND (oper, 0); This is STRIP_NOPS. + to placement new is not checked since it's unknownwhat it might Missing space. + else if

Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-11-02 Thread Jason Merrill
On 10/26/2015 09:48 PM, Martin Sebor wrote: + while (TREE_CODE (oper) == NOP_EXPR) +oper = TREE_OPERAND (oper, 0); This is STRIP_NOPS. + to placement new is not checked since it's unknownwhat it might Missing space. + else if (TREE_CODE (oper) == ADDR_EXPR) { The brace should

[PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-10-26 Thread Martin Sebor
[CC Jason] When you have a chance, the patch is at the link below for review: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02001.html On 10/20/2015 01:57 PM, Martin Sebor wrote: Attached is a slightly updated patch that tweaks the diagnostic messages to avoid assuming the English punctuation,

[PING] [PATCH] c++/67942 - diagnose placement new buffer overflow

2015-10-20 Thread Martin Sebor
Attached is a slightly updated patch that tweaks the diagnostic messages to avoid assuming the English punctuation, and adds a few test cases exercising the text of the diagnostics. Martin On 10/13/2015 11:22 AM, Martin Sebor wrote: C++ placement new expression is susceptible to buffer

[PATCH] c++/67942 - diagnose placement new buffer overflow

2015-10-13 Thread Martin Sebor
C++ placement new expression is susceptible to buffer overflow flaws (see [1]). In many such cases GCC has sufficient information to detect and diagnose such defects. The attached patch is a starting point for this feature. It lets GCC diagnose basic cases of buffer overflows when both the size