Re: [PATCH] warn for unsafe calls to __builtin_return_address

2015-06-11 Thread Martin Sebor
function (since every function has main as its direct or indirect caller). Tested on powerpc64le and x86_64 Linux. Martin The ChangeLog entries for gcc and testsuite: 2015-06-11 Martin Sebor mse...@redhat.com * c-family/c.opt (-Wbuiltin-address): New warning option. * doc

Re: [PATCH] 65479 - sanitizer stack trace missing frames past #0 on powerpc64

2015-06-11 Thread Martin Sebor
OK. You can go ahead and commit the libbacktrace fix. Committed in r224402. Let's hold off on the testsuite fixes until we've got the sanitizer libbacktrace fixes installed. Okay. Martin

Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-07-04 Thread Martin Sebor
2015-07-04 Martin Sebor mse...@redhat.com pr c/66516 * tree.h (DECL_IS_GCC_BUILTIN): New macro. * doc/extend.texi (Other Builtins): Document when the address of a built-in function can be taken. gcc/c/ChangeLog 2015-07-04 Martin Sebor mse...@redhat.com pr c/66516 * c-tree.h

[PING 3] Re: [PATCH] warn for unsafe calls to __builtin_return_address

2015-07-06 Thread Martin Sebor
This is a small change to diagnose unsafe calls to __builtin_{frame,return}_address (with an argument 2) than tend to return bogus values or lead to crashes at runtime. A review would be appreciated. Thanks Martin On 06/26/2015 05:49 PM, Martin Sebor wrote: Is this patch okay for trunk

Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-06-28 Thread Martin Sebor
. Bootstrapped and tested on x86_64-unknown-linux-gnu. Martin 2015-06-28 Martin Sebor mse...@redhat.com pr c/66516 * tree.h (DECL_IS_GCC_BUILTIN): New macro. * doc/extend.texi (Other Builtins): Document when the address of a builtin function can be taken. 2015-06-28 Martin Sebor mse

Re: [PATCH] clarify doc for __builtin_return_address

2015-05-21 Thread Martin Sebor
On 05/21/2015 02:05 PM, Sandra Loosemore wrote: On 05/21/2015 01:19 PM, Martin Sebor wrote: 2015-05-21 Martin Sebor mse...@redhat.com * extend.texi (Return Address): Clarify possible effects of calling the functions with non-zero arguments. diff --git a/gcc/doc/extend.texi b/gcc

[PATCH] clarify doc for __builtin_return_address

2015-05-21 Thread Martin Sebor
me to figure out this is by design. Does anyone have any concerns with this update or is it okay to check in? Thanks Martin 2015-05-21 Martin Sebor mse...@redhat.com * extend.texi (Return Address): Clarify possible effects of calling the functions with non-zero arguments. diff

Re: [patch] libstdc++/66017 Avoid bad casts and fix alignment of _Rb_tree_nodelong long::_M_storage

2015-05-22 Thread Martin Sebor
On 05/22/2015 09:13 AM, Jakub Jelinek wrote: On Fri, May 22, 2015 at 03:59:47PM +0100, Jonathan Wakely wrote: + alignas(alignof(_Tp2)) unsigned char _M_storage[sizeof(_Tp)]; Is alignof(_Tp2) always the same as alignof(_Tp2::_M_t) on all targets (I mean, won't some target align the

Re: [BUILDROBOT] Go runtime: calling ‘__builtin_frame_address’ with a nonzero argument is unsafe

2015-08-03 Thread Martin Sebor
On 08/03/2015 05:55 AM, Jan-Benedict Glaw wrote: On Sun, 2015-08-02 17:15:27 -0600, Martin Sebor mse...@gmail.com wrote: OK for the trunk. Sorry for the delay. Thank you. Committed in revision 226480. ...und breaks native builds. When doing builds using config-list.mk, I first build a GCC

Re: [PATCH] Allow embedded timestamps by C/C++ macros to be set externally

2015-06-30 Thread Martin Sebor
In the debian reproducible builds project we have considered several options to address this issue. We considered redefining the __DATE__ and __TIME__ defines by command line flags passed to gcc, but as you say, that triggers warnings, which could become errors when building with -Werror and thus

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-07-29 Thread Martin Sebor
On 07/28/2015 09:38 PM, Jason Merrill wrote: Sorry about the slow response on IRC today, I got distracted onto another issue and forgot to check back. What I started to write: No problem. I'm exploring your suggestion to see if the back end could emit the diagnostics. But I'm not sure it

Re: [PATCH] warn for unsafe calls to __builtin_return_address

2015-08-02 Thread Martin Sebor
OK for the trunk. Sorry for the delay. Thank you. Committed in revision 226480. Martin

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-08-03 Thread Martin Sebor
I suspect the back end or even the middle end route isn't going to work even if there was enough context to diagnose the problem expressions because some of them will have been optimized away by then (e.g., 'if ( __builtin_foo != 0)' is optimized into if (1) by gimple). I was thinking that if

Re: [PATCH] warn for unsafe calls to __builtin_return_address

2015-07-28 Thread Martin Sebor
gcc/ChangeLog 2015-07-27 Martin Sebor mse...@redhat.com * c-family/c.opt (-Wbuiltin-address): New warning option. * doc/invoke.texi (Wbuiltin-address): Document it. * doc/extend.texi (__builtin_frame_addrress, __builtin_return_addrress): Typoes (rr). Fixed. - rtx

Re: [PATCH] warn for unsafe calls to __builtin_return_address

2015-08-05 Thread Martin Sebor
On 08/05/2015 10:02 AM, Jiong Wang wrote: On 28/07/15 16:44, Martin Sebor wrote: Attached is an updated patch with the changes above. gcc/testsuite/ChangeLog 2015-07-28 Martin Sebormse...@redhat.com * g++.dg/Wframe-address-in-Wall.C: New test. * g++.dg/Wframe-address.C: New

Re: [PATCH] warn for unsafe calls to __builtin_return_address

2015-07-27 Thread Martin Sebor
patch to issue a warning for all builtin_xxx_address calls with any non-zero argument. Martin gcc/ChangeLog 2015-07-27 Martin Sebor mse...@redhat.com * c-family/c.opt (-Wbuiltin-address): New warning option. * doc/invoke.texi (Wbuiltin-address): Document it. * doc/extend.texi

Re: [C/C++ PATCH] Implement -Wtautological-compare (PR c++/66555, c/54979)

2015-07-22 Thread Martin Sebor
On 07/14/2015 09:18 AM, Marek Polacek wrote: Code such as if (i == i) is hardly ever desirable, so we should be able to warn about this to prevent dumb mistakes. I haven't tried the patch or even studied it very carefully but I wonder if this is also the case when i is declared volatile. I.e.,

Re: [C/C++ PATCH] Implement -Wtautological-compare (PR c++/66555, c/54979)

2015-07-22 Thread Martin Sebor
On 07/22/2015 01:06 PM, Marek Polacek wrote: On Wed, Jul 22, 2015 at 12:43:53PM -0600, Martin Sebor wrote: On 07/14/2015 09:18 AM, Marek Polacek wrote: Code such as if (i == i) is hardly ever desirable, so we should be able to warn about this to prevent dumb mistakes. I haven't tried

[PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-07-13 Thread Martin Sebor
[CC Jason since the patch also touches the C++ front end] The updated patch is here: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg00258.html Thanks Martin On 07/04/2015 04:32 PM, Martin Sebor wrote: I don't think c_validate_addressable is a good name - given that it's called for lots

[PING 4] Re: [PATCH] warn for unsafe calls to __builtin_return_addres

2015-07-13 Thread Martin Sebor
Still looking for a review of this small patch to help detect potentially unsafe calls to __builtin_{frame,return}_address (with an argument 2) that tend to either return bogus values or lead to crashes at runtime. The problem the function can cause was originally reported in pr8743 and

[PING 5] Re: [PATCH] warn for unsafe calls to __builtin_return_addres

2015-07-20 Thread Martin Sebor
Ping #5. On 07/13/2015 09:33 PM, Martin Sebor wrote: Still looking for a review of this small patch to help detect potentially unsafe calls to __builtin_{frame,return}_address (with an argument 2) that tend to either return bogus values or lead to crashes at runtime. The problem the function

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-07-14 Thread Martin Sebor
On 07/14/2015 09:01 AM, Jason Merrill wrote: I wonder if it would make sense to handle this when we actually try to emit a reference to one of these functions in the back end, rather than in many places through the front end. If it's going to stay in the front end, the C and C++ front-ends

Re: [PATCH 3 of 3] print help for undocumented options

2015-10-22 Thread Martin Sebor
On 10/22/2015 03:47 PM, Joseph Myers wrote: On Thu, 22 Oct 2015, Martin Sebor wrote: While fixing up the ChangeLogs for the commit (as requested below) I noticed that a number of new options have been added with help text with no period at the end. The attached patch fixes those up and adds

Re: [PATCH 3 of 3] print help for undocumented options

2015-10-22 Thread Martin Sebor
://gcc.gnu.org/ml/gcc-patches/2015-10/msg02224.html gcc/ChangeLog: 2015-10-22 Martin Sebor <mse...@redhat.com> PR driver/68043 * config/i386/i386.opt: Add missing periods to the ends of sentences. * config/msp430/msp430.opt: Same. gcc/testsuite/ChangeLog: 2015-10-22 Martin Sebor <mse...@r

[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] Re: [PATCH] c++/67913, 67917 - fix new expression with wrong number of elements

2015-10-26 Thread Martin Sebor
[CC Jason] The patch is at the link below: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01803.html Thanks On 10/19/2015 12:50 PM, Martin Sebor wrote: This is a patch for two C++ bugs: 67913 - new expression with negative size not diagnosed 67927 - array new expression with excessive

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-23 Thread Martin Sebor
On 10/23/2015 11:45 AM, Bernd Schmidt wrote: On 10/23/2015 06:50 PM, Joseph Myers wrote: On Fri, 23 Oct 2015, Martin Sebor wrote: But now that I'm re-reading the answer above I see that Joseph was suggesting that a5_7[5][0] should be diagnosed when the patch accepts it as an extension. I

[PATCH] clarify documentation of -Q --help=optimizers

2015-10-22 Thread Martin Sebor
[Sending to the right list this time] The documentation of the -Q --help=optimizers options leads some to expect that when options are reported as enabled imply the corresponding optimization will take place. (See the following question on gcc-help:

Re: [PATCH 1 of 2] print help for undocumented options

2015-10-21 Thread Martin Sebor
in this message. Attached is patch 1 with the changes to opts.c you mention below, adding periods to the help output printed by the driver, and some tweaks to the test suite, plus changelogs for both sets. Martin gcc/ChangeLog: 2015-10-21 Martin Sebor <mse...@redhat.com> PR driver

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-23 Thread Martin Sebor
On 10/23/2015 05:13 AM, Bernd Schmidt wrote: On 10/21/2015 12:10 AM, Joseph Myers wrote: On Tue, 20 Oct 2015, Bernd Schmidt wrote: How about [2].a and [2].b I don't think either is valid. typedef struct FA5_7 { int i; char a5_7 [5][7]; } FA5_7; __builtin_offsetof

Re: [PATCH 1 of 2] print help for undocumented options

2015-10-22 Thread Martin Sebor
On 10/22/2015 04:24 AM, Eric Botcazou wrote: Martin, some subdirectories have their own ChangeLog file so you need to move... 2015-10-21 Martin Sebor <mse...@redhat.com> PR driver/68043 * opts.c (undocumented_msg, use_diagnosed_msg): New g

Re: [C/C++ PATCH] Reject declarators with huge arrays (PR c/68107, c++/68266)

2015-11-10 Thread Martin Sebor
On 11/10/2015 09:36 AM, Marek Polacek wrote: While both C and C++ FEs are able to reject e.g. int a[__SIZE_MAX__ / sizeof(int)]; they are accepting code such as int (*a)[__SIZE_MAX__ / sizeof(int)]; As Joseph pointed out, any construction of a non-VLA type whose size is half or more of the

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: [C/C++ PATCH] Reject declarators with huge arrays (PR c/68107, c++/68266)

2015-11-11 Thread Martin Sebor
Oh, and we could also be more informative and print the size of an array, or the number of elements, as clang does. Yes, that's pretty nice. It helps but the diagnostic must point at the right dimension. GCC often just points at the whole expression or some token within it. void* foo () {

Re: [patch] Implement std::experimental::source_location (sort of)

2015-11-13 Thread Martin Sebor
On 11/13/2015 08:21 AM, Martin Sebor wrote: On 11/13/2015 05:56 AM, Jonathan Wakely wrote: This is a non-conforming implementation of https://rawgit.com/cplusplus/fundamentals-ts/v2/fundamentals-ts.html#reflection.src_loc It doesn't provide any column numbers, and fails to meet

Re: [patch] Implement std::experimental::source_location (sort of)

2015-11-13 Thread Martin Sebor
On 11/13/2015 05:56 AM, Jonathan Wakely wrote: This is a non-conforming implementation of https://rawgit.com/cplusplus/fundamentals-ts/v2/fundamentals-ts.html#reflection.src_loc It doesn't provide any column numbers, and fails to meet the requirement that using current() in a NSDMI will refer

Re: [patch] libstdc++/56158 Extend valid values of iostream bitmask types

2015-11-12 Thread Martin Sebor
On 11/11/2015 02:48 AM, Jonathan Wakely wrote: As described in the PR, we have operator~ overloads defined for enumeration types which produce values outside the range of valid values for the type. In C++11 that can be trivially solved by giving the enumeration types a fixed underlying type, but

Re: [patch] libstdc++/56158 Extend valid values of iostream bitmask types

2015-11-12 Thread Martin Sebor
On 11/12/2015 10:08 AM, Jonathan Wakely wrote: On 12/11/15 08:48 -0700, Martin Sebor wrote: On 11/11/2015 02:48 AM, Jonathan Wakely wrote: As described in the PR, we have operator~ overloads defined for enumeration types which produce values outside the range of valid values for the type. In C

[PATCH] correct -Wself-init diagnostic location

2015-11-11 Thread Martin Sebor
Martin Sebor <mse...@redhat.com> PR c++/68208 * init.c (perform_member_init): Use location of member-initializer in -Wself-init rather than that of the ctor. gcc/testsuite/ 2015-11-11 Martin Sebor <mse...@redhat.com> PR c++/68208 * b/gcc/testsuite/g++.dg/warn/Winit-self-4.C: New

[PATCH] fix c++/68308 - [6 Regression] ICE: tree check: expected integer_cst

2015-11-17 Thread Martin Sebor
Attached is a patch fixing the ICE caused by a prior change of mine: https://gcc.gnu.org/viewcvs/gcc?view=revision=230081 Tested on x86_64, committing to trunk as per Jason via IRC. Martin gcc/ChangeLog: 2015-11-17 Martin Sebor <mse...@redhat.com> PR c++/68308 * cp/

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-11-09 Thread Martin Sebor
On 11/07/2015 04:38 PM, Segher Boessenkool wrote: On Tue, Oct 20, 2015 at 10:10:44PM +, Joseph Myers wrote: typedef struct FA5_7 { int i; char a5_7 [5][7]; } FA5_7; __builtin_offsetof (FA5_7, a5_7 [0][7]), // { dg-warning "index" } __builtin_offsetof (FA5_7, a5_7

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

2015-11-04 Thread Martin Sebor
other cleanup. Attached is an updated patch. Tested on x86_64 by botstrapping C and C++ and running make check. Martin gcc ChangeLog 2015-11-04 Martin Sebor <mse...@redhat.com> PR c++/67942 * invoke.texi (-Wplacement-new): Document new option. * gcc/testsuite/g++.dg/warn/Wpla

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-04 Thread Martin Sebor
On 11/03/2015 03:19 AM, Alexander Monakov wrote: On Thu, 22 Oct 2015, Martin Sebor wrote: [Sending to the right list this time] The documentation of the -Q --help=optimizers options leads some to expect that when options are reported as enabled imply the corresponding optimization will take

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-11-03 Thread Martin Sebor
I guess this is a case where I could say either "I wrote the patch" or "I requested changes to a patch in review"; in the latter case I can approve it. Joseph seems on board with what we've discussed, so I'd say please wait until Tuesday for objections then commit. I didn't get to committing

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-04 Thread Martin Sebor
On 11/04/2015 06:09 PM, Sandra Loosemore wrote: On 11/04/2015 04:52 PM, Martin Sebor wrote: gcc/ChangeLog: 2015-11-04 Martin Sebor <mse...@redhat.com> * opts.c (print_filtered_help): Indicate when an optimization option is disabled as a result of -O0. * doc/invoke.texi: F

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-05 Thread Martin Sebor
On 11/05/2015 10:10 AM, Joseph Myers wrote: On Thu, 5 Nov 2015, Martin Sebor wrote: optimiziation. We seem to have consensus that even though there might be exceptions (do we know what some of them are?) the vast majority optimizations that have -fxxx options are in fact not performed at -O0

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-05 Thread Martin Sebor
On 11/05/2015 03:48 AM, Alexander Monakov wrote: On Thu, 5 Nov 2015, Joseph Myers wrote: On Wed, 4 Nov 2015, Martin Sebor wrote: Improving the compiler output is a good idea. The attached patch prints "[disabled by -O0]" instead of "[enabled]" when an optimization option i

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 <mse...@redhat.com> PR c++/67942 * invoke.texi (-Wplacement-new): Document new option.

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-05 Thread Martin Sebor
On 11/05/2015 11:07 AM, Joseph Myers wrote: On Thu, 5 Nov 2015, Martin Sebor wrote: There are several options marked Optimization that are actually matters of language semantics that I don't think have anything to do with -O options, e.g. -fexceptions and -fcx-limited-range. The Optimization

Re: [PING] Re: [PATCH] c++/67913, 67917 - fix new expression with wrong number of elements

2015-11-05 Thread Martin Sebor
On 11/02/2015 09:55 PM, Jason Merrill wrote: On 10/26/2015 10:06 PM, Martin Sebor wrote: + if (TREE_CONSTANT (maybe_constant_value (outer_nelts))) +{ + if (tree_int_cst_lt (max_outer_nelts_tree, outer_nelts)) maybe_constant_value may return a constant, but that doesn't mean

Re: [PATCH] Add configure flag for operator new (std::nothrow)

2015-11-04 Thread Martin Sebor
I share your concerns, but I'm also sympathetic to the changes that the Taller Technologies team are trying to make, to allow libstdc++ to be more useful in exception-free systems. At the very least the patch to doc/xml/manual/configure.xml must document that this option enables behaviour that

Re: [PATCH] Add configure flag for operator new (std::nothrow)

2015-11-03 Thread Martin Sebor
Besides violating the requirement of the C++ standard, replacing Could you please point us to the relevant section where this behavior is enforced? We couldn't find it so far. The Required behavior of the nothrow operator new reads: This nothrow version of operator new returns a pointer

Re: [PATCH] Add configure flag for operator new (std::nothrow)

2015-11-03 Thread Martin Sebor
On 11/03/2015 05:35 AM, Aurelio Remonda wrote: Currently, whenever operator new (std::nothrow) fails to allocate memory, it'll check if there is a new-handler function available. If there is, it'll call the handler and then try to allocate again. Otherwise, it'll return a null pointer. This

Re: [PATCH] Add configure flag for operator new (std::nothrow)

2015-11-03 Thread Martin Sebor
On 11/03/2015 04:08 PM, Mike Stump wrote: On Nov 3, 2015, at 1:10 PM, Martin Sebor <mse...@gmail.com> wrote: The "as if" requirement implies that any observable effects of "the (possibly replaced) ordinary version" must be preserved. The repeated calls to the new hand

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

[PING] [PATCH] clarify documentation of -Q --help=optimizers

2015-11-02 Thread Martin Sebor
Ping. Thanks in advance for a review. On 10/22/2015 08:12 PM, Martin Sebor wrote: [Sending to the right list this time] The documentation of the -Q --help=optimizers options leads some to expect that when options are reported as enabled imply the corresponding optimization will take place

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-05 Thread Martin Sebor
On 11/05/2015 10:09 AM, Segher Boessenkool wrote: On Thu, Nov 05, 2015 at 08:58:25AM -0700, Martin Sebor wrote: I don't think that reiterating in a condensed form what the manual doesn't make clear in many more words will help. First, even users who do find the relevant text in the manual often

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

Re: [PATCH] clarify documentation of -Q --help=optimizers

2015-11-05 Thread Martin Sebor
On 11/05/2015 04:30 PM, Segher Boessenkool wrote: On Thu, Nov 05, 2015 at 02:04:47PM -0700, Martin Sebor wrote: On 11/05/2015 10:09 AM, Segher Boessenkool wrote: On Thu, Nov 05, 2015 at 08:58:25AM -0700, Martin Sebor wrote: I don't think that reiterating in a condensed form what the manual

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

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 <mse...@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/g

Re: [PATCH] Merge from gomp-4_5-branch to trunk

2015-11-06 Thread Martin Sebor
in the future. If there is a page on the Wiki or somewhere with best practices or recommended steps that someone knows about, I'd be grateful for a pointer. Again, sorry for the breakage. Martin 2015-11-05 Martin Sebor <mse...@redhat.com> PR c++/67942 * invok

Re: [PATCH] c/67925 - update documentation on `inline'

2015-10-14 Thread Martin Sebor
On 10/13/2015 04:47 PM, Arkadiusz Drabczyk wrote: * gcc/doc/extend.texi: documentation says that functions declared `inline' would not be integrated if they are called before they are defined or if they are recursive. Both of these statements is now false as shown in examples on Bugzilla. It

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-16 Thread Martin Sebor
On 10/16/2015 06:27 AM, Bernd Schmidt wrote: On 10/09/2015 04:55 AM, Martin Sebor wrote: Gcc attempts to diagnose invalid offsetof expressions whose member designator is an array element with an out-of-bounds index. The logic in the function that does this detection is incomplete, leading

Re: [PATCH] print help for undocumented options

2015-10-14 Thread Martin Sebor
On 10/14/2015 11:24 AM, Joseph Myers wrote: On Wed, 14 Oct 2015, Martin Sebor wrote: + /* For undocumented options that are aliases for other +options that are documented, print the other option's +help and name. */ + help = cl_options

[PING] [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-15 Thread Martin Sebor
The patch is at the following link: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg00915.html Martin On 10/08/2015 08:55 PM, Martin Sebor wrote: Gcc attempts to diagnose invalid offsetof expressions whose member designator is an array element with an out-of-bounds index. The logic

[PATCH] c++/67913, 67917 - fix new expression with wrong number of elements

2015-10-19 Thread Martin Sebor
to expect a meaningful error message. Once this patch is approved and committed a follow-up patch should document the implementation-defined maximum to the manual. Martin gcc/cp/ChangeLog 2015-10-19 Martin Sebor <mse...@redhat.com> PR c++/67913 PR c++/67927 * call.c (build_operator_ne

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-20 Thread Martin Sebor
On 10/20/2015 10:57 AM, Joseph Myers wrote: On Tue, 20 Oct 2015, Martin Sebor wrote: An array subscript is out of range, even if an object is apparently accessible with the given subscript (as in the lvalue expression a[1][7] given the declaration int a[4][5]) (6.5.6). Just-past

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-20 Thread Martin Sebor
On 10/20/2015 07:20 AM, Bernd Schmidt wrote: On 10/16/2015 09:34 PM, Martin Sebor wrote: Thank you for the review. Attached is an updated patch that hopefully addresses all your comments. I ran the check_GNU_style.sh script on it to make sure I didn't miss something. I've also added replies

Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-20 Thread Martin Sebor
On 10/20/2015 09:48 AM, Bernd Schmidt wrote: On 10/20/2015 05:31 PM, Martin Sebor wrote: On 10/20/2015 07:20 AM, Bernd Schmidt wrote: On 10/16/2015 09:34 PM, Martin Sebor wrote: Thank you for the review. Attached is an updated patch that hopefully addresses all your comments. I ran

[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

Re: [PATCH] c/67925 - update documentation on `inline'

2015-10-14 Thread Martin Sebor
On 10/14/2015 03:42 PM, Arkadiusz Drabczyk wrote: On Wed, Oct 14, 2015 at 08:36:43AM -0600, Martin Sebor wrote: On 10/13/2015 04:47 PM, Arkadiusz Drabczyk wrote: * gcc/doc/extend.texi: documentation says that functions declared `inline' would not be integrated if they are called before

[PATCH] print help for undocumented options

2015-10-14 Thread Martin Sebor
s -A 2015-10-14 Martin Sebor <mse...@redhat.com> * options.c (print_filtered_help): Print help for aliased option and its name instead of undocumented text for undocumented options. diff --git a/gcc/opts.c b/gcc/opts.c index 2bbf653..e441924 100644 --- a/gcc/

Re: [PATCH] print help for undocumented options

2015-10-14 Thread Martin Sebor
On 10/14/2015 01:40 PM, Joseph Myers wrote: On Wed, 14 Oct 2015, Martin Sebor wrote: IMO, printing the aliased option's help text makes using the output easier for users who find the undocumented option first, in that they don't then have to go look for the one that does have documentation, so

[PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-08 Thread Martin Sebor
Gcc attempts to diagnose invalid offsetof expressions whose member designator is an array element with an out-of-bounds index. The logic in the function that does this detection is incomplete, leading to false negatives. Since the result of the expression in these cases can be surprising, this

[PATCH] c/67882 - improve -Warray-bounds for invalid offsetof

2015-10-08 Thread Martin Sebor
Gcc attempts to diagnose invalid offsetof expressions whose member designator is an array element with an out-of-bounds index. The logic in the function that does this detection is incomplete, leading to false negatives. Since the result of the expression in these cases can be surprising, this

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

2015-10-13 Thread Martin Sebor
Conference on Distributed Computing Systems (ICDCS), 2011 http://ieeexplore.ieee.org/stamp/stamp.jsp?tp==5961725 gcc ChangeLog 2015-10-12 Martin Sebor <mse...@redhat.com> PR c++/67942 * invoke.texi (-Wplacement-new): Document new option. * gcc/testsuite/g++.dg/warn/Wplaceme

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-09-01 Thread Martin Sebor
On 09/01/2015 11:29 AM, Joseph Myers wrote: On Tue, 1 Sep 2015, Martin Sebor wrote: Attached is an updated patch that avoids diagnosing taking the address of implicitly declared library builtins like abs, bootstrapped and tested on ppc64le with no regressions. The tweak below was added

Re: [patch] libstdc++/65473 Make define libstdc++ version macros.

2015-09-03 Thread Martin Sebor
On 09/03/2015 04:58 AM, Jonathan Wakely wrote: This change would allow including to be used to check for __GLIBCXX__ and detect whether youre using libstdc++ or not. Howard Hinnant recommends including that header for libc++ because it has no other effects in C++. We could make every header

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-09-03 Thread Martin Sebor
You've committed empty gcc/builtins.c.orig file, I've removed it, but please be more careful next time. And c/ or cp/ prefixes don't belong to c/ChangeLog or cp/ChangeLog (also fixed). Jakub Thank you for fixing that up. Martin

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-09-02 Thread Martin Sebor
On 09/02/2015 09:29 AM, Jason Merrill wrote: On 09/01/2015 06:25 PM, Martin Sebor wrote: Having now made this change, I don't think the added complexity of three declarations and two trivial definitions of the new c_decl_implicit function across five files is an improvement, Three

Re: [PING] Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function

2015-09-01 Thread Martin Sebor
, the more descriptive C_DECL_IMPLICIT that exists for this purpose is not available (it's defined in c/c-tree.h). + && (c_dialect_cxx () || !DECL_LANG_FLAG_2 (expr)) Martin gcc/ChangeLog 2015-08-31 Martin Sebor <mse...@redhat.com> PR c/66516 * doc/extend.texi (Other Builtins):

Re: [wwwdocs] Document some gcc-6 changes

2015-09-08 Thread Martin Sebor
On 09/08/2015 11:14 AM, Manuel López-Ibáñez wrote: I also took the liberty of rewriting the list of new command-line options to be less repetitive. ... a negative value. -A new command-line option -Wshift-overflow has been - added for the C and C++ compilers, which warns

Re: [patch] Enable lightweight checks with _GLIBCXX_ASSERTIONS.

2015-09-10 Thread Martin Sebor
On 09/10/2015 10:38 AM, Florian Weimer wrote: On 09/10/2015 06:30 PM, Martin Sebor wrote: On 09/09/2015 09:58 AM, Florian Weimer wrote: On 09/08/2015 05:45 PM, Jonathan Wakely wrote: I doubt we can achieve the complexity goals in all cases. I expect that for (int i = 0; i < 1;

Re: [patch] Enable lightweight checks with _GLIBCXX_ASSERTIONS.

2015-09-10 Thread Martin Sebor
On 09/09/2015 09:58 AM, Florian Weimer wrote: On 09/08/2015 05:45 PM, Jonathan Wakely wrote: I doubt we can achieve the complexity goals in all cases. I expect that for (int i = 0; i < 1; ++i) { vector[i]; } is optimized away in default mode, but with _GLIBCXX_ASSERTIONS, it is

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-12 Thread Martin Sebor
On 09/12/2015 04:09 AM, Jonathan Wakely wrote: On 11 September 2015 at 18:39, Martin Sebor wrote: On 09/11/2015 08:21 AM, Jonathan Wakely wrote: Solaris 10 doesn't follow POSIX in accepting a null pointer as the second argument to realpath(), so allocate a buffer for it. FWIW, the NULL

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-12 Thread Martin Sebor
On 09/12/2015 12:07 PM, Martin Sebor wrote: On 09/12/2015 04:09 AM, Jonathan Wakely wrote: On 11 September 2015 at 18:39, Martin Sebor wrote: On 09/11/2015 08:21 AM, Jonathan Wakely wrote: Solaris 10 doesn't follow POSIX in accepting a null pointer as the second argument to realpath(), so

Re: [PATCH 15/22] Add plugin to recursively dump the source-ranges in a tree

2015-09-10 Thread Martin Sebor
On 09/10/2015 02:28 PM, David Malcolm wrote: This patch adds a test plugin that recurses down an expression tree, printing diagnostics showing the ranges of each node in the tree. Screenshot: https://dmalcolm.fedorapeople.org/gcc/2015-09-09/show-trees.html This needs a linker hack, since

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-11 Thread Martin Sebor
On 09/11/2015 08:21 AM, Jonathan Wakely wrote: Solaris 10 doesn't follow POSIX in accepting a null pointer as the second argument to realpath(), so allocate a buffer for it. FWIW, the NULL requirement is new in Issue 7. In Issue 6, the behavior is implementation-defined, and before then it was

Re: [PATCH] Warn when comparing nonnull arguments to NULL in a function.

2015-09-14 Thread Martin Sebor
+void foo(void *bar) __attribute__((nonnull(1))); + +void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "null" "argument ‘bar’ compared to NULL" } */ This looks like a very useful enhancement. Since the change is limited to build_binary_op in the two front ends I wonder if the warning

Re: [C PATCH] Better diagnostics for missing struct/union (PR c/67580)

2015-09-15 Thread Martin Sebor
On 09/15/2015 10:52 AM, Marek Polacek wrote: Currently, when one writes a code that is missing the struct/union/enum tag, we get less than ideal error message. The following patch improves the situation a bit by giving a hint to the user. I can't count the number of times I've made this

Re: [C/C++ PATCH] RFC: Implement -Wduplicated-cond (PR c/64249)

2015-09-16 Thread Martin Sebor
On 09/16/2015 09:59 AM, Marek Polacek wrote: This patch implements a new warning, -Wduplicated-cond. It warns for code such as if (x) // ... else if (x) // ... As usual, I like this improvement. I think it's worth extending to conditional expressions (e.g., x ? f() : x ? g()

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-16 Thread Martin Sebor
Tested powerpc64le-linux, x86_64-dragonfly4.1 and x86_64-netbsd5.1, do you see any reason not to commit this for now? I see only a couple of potential problems: a missing test for PATH_MAX in the unlikely event it's not defined (or is obscenely large), and a missing check to avoid infinite

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-16 Thread Martin Sebor
On 09/16/2015 04:17 PM, Jonathan Wakely wrote: On 16/09/15 16:04 -0600, Martin Sebor wrote: Tested powerpc64le-linux, x86_64-dragonfly4.1 and x86_64-netbsd5.1, do you see any reason not to commit this for now? I see only a couple of potential problems: a missing test for PATH_MAX

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-16 Thread Martin Sebor
It turns out I was wrong about BSD traditionally supporting realpath(path, NULL), it first appeared in these relatively recent versions: FreeBSD 9.0 OpenBSD 5.0 NetBSD 6.1 Like Solaris 11, some of them still define _POSIX_VERSION=200112L even though they support passing NULL, so we could

Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.

2015-09-17 Thread Martin Sebor
On 09/17/2015 05:16 AM, Jonathan Wakely wrote: On 16/09/15 17:42 -0600, Martin Sebor wrote: I see now the first exists test will detect symlink loops in the original path. But I'm not convinced there isn't a corner case that's subject to a TOCTOU race condition between the first exists test

Re: [C/C++ PATCH] RFC: Implement -Wduplicated-cond (PR c/64249)

2015-09-17 Thread Martin Sebor
The patch currently issues a false positive for the test case below. I suspect the chain might need to be cleared after each condition that involves a side-effect. int foo (int a) { if (a) return 1; else if (++a) return 2; else if (a) return 3; return 0; } But the last

Re: [PATCH] Warn when comparing nonnull arguments to NULL in a function.

2015-09-15 Thread Martin Sebor
On 09/15/2015 02:32 AM, Mark Wielaard wrote: On Mon, 2015-09-14 at 21:37 -0600, Martin Sebor wrote: +void foo(void *bar) __attribute__((nonnull(1))); + +void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "null" "argument ‘bar’ compared to NULL" } */ This look

Re: [patch] Leave errno unchanged by successful std::stoi etc

2015-09-29 Thread Martin Sebor
On 09/29/2015 10:15 AM, Jakub Jelinek wrote: On Tue, Sep 29, 2015 at 05:10:20PM +0100, Jonathan Wakely wrote: That looks wrong to me, you only restore errno if you don't throw :(. If you throw, then errno might remain 0, which is IMHO undesirable. My thinking was that a failed conversion that

<    1   2   3   4   5   6   7   8   9   10   >