Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-06-29 Thread Martin Sebor
On 06/29/2017 04:34 PM, Jan Hubicka wrote: The warning in the original code could have been suppressed (by casting the pointer to char*), but it was valid so I opted not to. I'd expect it to be possible to work around the bug but I don't have easy access to GCC 4.2 to reproduce it or verify

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-29 Thread Martin Sebor
On 06/29/2017 09:56 AM, Joseph Myers wrote: On Wed, 28 Jun 2017, Martin Sebor wrote: The more limited interfaces could, of course, be __typeof_noqual in some form. Actually, despite what I've been arguing, I agree. I've come to realize that what makes me uneasy about it is its name

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-06-30 Thread Martin Sebor
On 06/30/2017 02:34 AM, Richard Biener wrote: On Thu, Jun 29, 2017 at 10:23 PM, Martin Sebor <mse...@gmail.com> wrote: On 06/29/2017 10:15 AM, Jan Hubicka wrote: Hello, diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 0f7e21a..443d16c 100644 --- a/gcc/hash-table.h +++ b/gc

[PATCH] enhance -Wrestrict for sprintf %s arguments

2017-07-02 Thread Martin Sebor
The attached patch enhances the -Wrestrict warning to detect more than just trivial instances of overlapping copying by sprintf and related functions. The meat of the patch is relatively simple but because it introduces dependencies between existing classes in the sprintf pass I had to move the

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-28 Thread Martin Sebor
I don't know if that wouldn't be overkill. Qualifiers on rvalues are meaningless in C and that's why my __typeof_noqual strips them all. We'd then need even e.g. __remove_restrict, not sure if there's need for these. Maybe it is. Unless __typeof__ (p) q = p; declares a restrict-qualified q

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-27 Thread Martin Sebor
On 06/27/2017 07:14 AM, Marek Polacek wrote: On Mon, Jun 26, 2017 at 10:37:03AM -0600, Martin Sebor wrote: On 06/23/2017 08:46 AM, Marek Polacek wrote: This patch adds a variant of __typeof, called __typeof_noqual. As the name suggests, this variant always drops all qualifiers, not just when

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-28 Thread Martin Sebor
On 06/28/2017 10:09 AM, Joseph Myers wrote: On Wed, 28 Jun 2017, Martin Sebor wrote: that defines "remove qualifiers except" operations for every combination of qualifiers in that version of the compiler (because "remove qualifiers except _Atomic" and "remove qualifi

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-28 Thread Martin Sebor
On 06/28/2017 03:19 AM, Joseph Myers wrote: On Wed, 28 Jun 2017, Martin Sebor wrote: I.e., just having blocks to remove qualifiers of kind X is not sufficient without "remove all qualifiers (possibly except these kinds)" as well. I suppose you could have __remove_quals (const volati

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-27 Thread Martin Sebor
On 06/27/2017 11:50 AM, Joseph Myers wrote: On Tue, 27 Jun 2017, Martin Sebor wrote: Another thing, with the current patch, __typeof_noqual__(const int) would still produce "const int". With the __atomic_load_n proposal it'd return "int". I don't know what we want

[PATCH] prevent -Wall from resetting -Wstringop-overflow=2 to 1 (pr 81345)

2017-07-06 Thread Martin Sebor
The -Wstringop-overflow option defaults to 2 (for Object Size Checking type 1). But when -Wall is used it resets the default value to 1. This happens because when I added the option to c.opt I assumed it would default to, well, the default value set by the Init() directive regardless of whether

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-07-05 Thread Martin Sebor
On 04/29/2017 09:09 PM, Martin Sebor wrote: Calling memset, memcpy, or similar to write to an object of a non-trivial type (such as one that defines a ctor or dtor, or has such a member) can break the invariants otherwise maintained by the class and cause undefined behavior. The motivating e

Re: [PATCH] handle sprintf(d, "%s", ...) in gimple-ssa-sprintf.c

2017-04-25 Thread Martin Sebor
On 04/25/2017 04:05 PM, Jeff Law wrote: On 04/21/2017 03:33 PM, Martin Sebor wrote: Bug 77671 - missing -Wformat-overflow warning on sprintf overflow with "%s", is caused by gimple-fold.c transforming s{,n}printf calls with a plain "%s" format string into strcpy r

Re: [PATCH][RFC] Enable -fstrict-overflow by default

2017-04-25 Thread Martin Sebor
On 04/24/2017 05:25 AM, Richard Biener wrote: The following makes signed overflow undefined for all (non-)optimization levels. The intent is to remove -fno-strict-overflow signed overflow behavior as that is not a sensible option to the user (it ends up with the worst of both -fwrapv and

Re: [PATCH] handle enumerated types in -Wformat-overflow (PR 80397)

2017-04-26 Thread Martin Sebor
On 04/24/2017 03:35 PM, Jeff Law wrote: On 04/11/2017 12:57 PM, Martin Sebor wrote: In a review of my fix for bug 80364 Jakub pointed out that to determine whether an argument to an integer directive is of an integer type the gimple-ssa-sprintf pass tests the type code for equality

Re: [PATCH][RFC] Enable -fstrict-overflow by default

2017-04-26 Thread Martin Sebor
On 04/26/2017 01:59 AM, Richard Biener wrote: On Tue, 25 Apr 2017, Martin Sebor wrote: On 04/24/2017 05:25 AM, Richard Biener wrote: The following makes signed overflow undefined for all (non-)optimization levels. The intent is to remove -fno-strict-overflow signed overflow behavior

Re: [PATCH] Improved diagnostics for casts and enums

2017-04-27 Thread Martin Sebor
On 04/27/2017 01:29 AM, Volker Reichelt wrote: Hi, the following two patches aim at improving GCC's diagnostics to help the user to get rid of old-style casts. While old-style pointer casts are really bad and need to be weeded out quickly, old-style casts between arithmetic types are IMHO much

[PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-26 Thread Martin Sebor
Testing my solution for bug 77671 (missing -Wformat-overflow sprintf with "%s") caused a regression in the charset/builtin2.c test for bug 25120 (builtin *printf handlers are confused by -fexec-charset). That led me to realize that like -Wformat itself, the whole gimple-ssa-sprintf pass is

[PATCH] squash spurious warnings in dominance.c

2017-04-21 Thread Martin Sebor
Bug 80486 - spurious -Walloc-size-larger-than and -Wstringop-overflow in dominance.c during profiledbootstrap points out a number of warnings that show up in dominance.c during a profiledbootstrap. I'm pretty sure the warnings are due to the size check the C++ new expression introduces to avoid

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-21 Thread Martin Sebor
On 04/20/2017 02:35 PM, Bernd Edlinger wrote: Hi! This implements a new -Wall enabled warning for a rather common, but completely wrong way to compute an array size by dividing the sizeof(pointer) / sizeof(pointer[0]) or sizeof(*pointer). It is often hard to find this kind of error by simple

Re: [PATCH] squash spurious warnings in dominance.c

2017-04-24 Thread Martin Sebor
On 04/24/2017 01:32 AM, Richard Biener wrote: On Sat, Apr 22, 2017 at 2:51 AM, Martin Sebor <mse...@gmail.com> wrote: Bug 80486 - spurious -Walloc-size-larger-than and -Wstringop-overflow in dominance.c during profiledbootstrap points out a number of warnings that show up in dominance.c

Re: [PATCH 3/8] Simplify representation of locations of a block.

2017-04-28 Thread Martin Sebor
On 04/28/2017 05:47 AM, Nathan Sidwell wrote: On 04/21/2017 10:02 AM, marxin wrote: gcc/ChangeLog: 2017-04-26 Martin Liska * gcov.c (struct block_location_info): New struct. (process_file): Fill up the new structure. (read_graph_file): Replace usage of encoding

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-28 Thread Martin Sebor
On 04/28/2017 10:22 AM, Jeff Law wrote: On 04/27/2017 03:05 PM, Martin Sebor wrote: On 04/26/2017 04:34 PM, Jakub Jelinek wrote: Also, can't there be a way to shortcut all this processing if the charsets are the same? And is it a good idea if every pass that needs to do something

Re: [PATCH 3/8] Simplify representation of locations of a block.

2017-04-28 Thread Martin Sebor
On 04/28/2017 01:01 PM, Pedro Alves wrote: On 04/28/2017 05:28 PM, Martin Sebor wrote: On 04/28/2017 05:47 AM, Nathan Sidwell wrote: @@ -427,9 +429,31 @@ static void output_lines (FILE *, const source_t *); static char *make_gcov_file_name (const char *, const char *); static char

Re: [PATCH 8/8] Enhance documentation of gcov.

2017-04-28 Thread Martin Sebor
On 04/27/2017 03:24 AM, marxin wrote: gcc/ChangeLog: 2017-04-27 Martin Liska * doc/gcov.texi: Enhance documentation of gcov. --- gcc/doc/gcov.texi | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index

[PATCH] disable -Walloc-size-larger-than and -Wstringop-overflow for non-C front ends (PR 80545)

2017-04-28 Thread Martin Sebor
The two options were included in -Wall and enabled for all front ends but only made to be recognized by the driver for the C family of compilers. That made it impossible to suppress those warnings when compiling code for those other front ends (like Fortran). The attached patch adjusts the

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-27 Thread Martin Sebor
On 04/26/2017 04:34 PM, Jakub Jelinek wrote: On Wed, Apr 26, 2017 at 10:26:56PM +, Joseph Myers wrote: On Wed, 26 Apr 2017, Martin Sebor wrote: Testing my solution for bug 77671 (missing -Wformat-overflow sprintf with "%s") caused a regression in the charset/builtin2.c test for

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-27 Thread Martin Sebor
I suggest avoiding "element size" because the pointed-to argument need not be an array. Mentioning the types should help users better understand the problem (especially in C++ where types are often obscured by layers of templates). It might also be a nice touch to add a note pointing to the

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-28 Thread Martin Sebor
On 04/28/2017 08:12 AM, Bernd Edlinger wrote: On 04/28/17 00:52, Martin Sebor wrote: I suggest avoiding "element size" because the pointed-to argument need not be an array. Mentioning the types should help users better understand the problem (especially in C++ where types are ofte

Re: [PATCH] handle sprintf(d, "%s", ...) in gimple-ssa-sprintf.c

2017-04-27 Thread Martin Sebor
On 04/25/2017 09:55 PM, Martin Sebor wrote: On 04/25/2017 04:05 PM, Jeff Law wrote: On 04/21/2017 03:33 PM, Martin Sebor wrote: Bug 77671 - missing -Wformat-overflow warning on sprintf overflow with "%s", is caused by gimple-fold.c transforming s{,n}printf calls with a plain "%s

Re: [PATCH][RFC] Enable -fstrict-overflow by default

2017-04-27 Thread Martin Sebor
On 04/27/2017 03:16 AM, Richard Biener wrote: On Wed, 26 Apr 2017, Martin Sebor wrote: On 04/26/2017 01:59 AM, Richard Biener wrote: On Tue, 25 Apr 2017, Martin Sebor wrote: On 04/24/2017 05:25 AM, Richard Biener wrote: The following makes signed overflow undefined for all (non

Re: [PATCH 0/2] add unique_ptr class

2017-08-04 Thread Martin Sebor
On 07/31/2017 05:46 PM, tbsaunde+...@tbsaunde.org wrote: From: Trevor Saunders Hi, I've been saying I'd do this for a long time, but I'm finally getting to importing the C++98 compatable unique_ptr class Pedro wrote for gdb a while back. I believe the gtl namespace

Re: [PATCH 00/17] RFC: New source-location representation; Language Server Protocol

2017-07-28 Thread Martin Sebor
Thanks for the explanation (snipped). * C++: add a fix-it hint to -Wsuggest-final-methods To answer your call for other ideas below: There are other suggestions that GCC could offer to help improve code, including * to add the const qualifier to function pointer and reference

[PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-07-31 Thread Martin Sebor
, Martin Sebor wrote: Ping: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01264.html This change is related to [PATCH] enhance -Wrestrict for sprintf %s arguments https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01176.html On 07/20/2017 02:45 PM, Martin Sebor wrote: With more testing

Re: [PATCH 00/19] cleanup of memory stats prototypes

2017-07-31 Thread Martin Sebor
On 07/31/2017 03:34 PM, Trevor Saunders wrote: On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote: On 07/27/2017 02:30 AM, tbsaunde+...@tbsaunde.org wrote: From: Trevor Saunders <tbsaunde+...@tbsaunde.org> The preC++ way of passing information about the call site of a fu

Re: [PATCH 00/19] cleanup of memory stats prototypes

2017-07-31 Thread Martin Sebor
On 07/31/2017 05:11 PM, Trevor Saunders wrote: On Mon, Jul 31, 2017 at 04:58:15PM -0600, Martin Sebor wrote: On 07/31/2017 03:34 PM, Trevor Saunders wrote: On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote: On 07/27/2017 02:30 AM, tbsaunde+...@tbsaunde.org wrote: From: Trevor

Re: [PATCH, rs6000] Clean up capitalized diagnostic messages

2017-08-02 Thread Martin Sebor
On 08/02/2017 09:29 AM, Bill Schmidt wrote: Hi, Jakub pointed out that we've had several error messages slip into the POWER back end that incorrectly start with a capital letter. This patch hunts those down and cleans them up. Others have already commented on some aspects of the patch but

Re: [PATCH][v2] Fix target attribute handling (PR c++/81355).

2017-08-08 Thread Martin Sebor
On 08/07/2017 10:59 PM, Martin Liška wrote: On 08/02/2017 09:56 PM, Martin Sebor wrote: On 08/02/2017 01:04 PM, Jeff Law wrote: On 07/28/2017 05:13 AM, Martin Liška wrote: Hello. Following patch skips empty strings in 'target' attribute. Patch can bootstrap on ppc64le-redhat-linux

Re: [PATCH 1/3] improve detection of attribute conflicts (PR 81544)

2017-08-09 Thread Martin Sebor
On 08/09/2017 11:13 AM, Joseph Myers wrote: On Wed, 9 Aug 2017, Martin Sebor wrote: diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c index 146b76c..58a4742 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c +++ b/gcc/testsuite/gcc.dg/tree

[PATCH 1/3] improve detection of attribute conflicts (PR 81544)

2017-08-08 Thread Martin Sebor
Part 1 of the patch series is the core of the enhancement without the (trivial) changes to the back ends and front ends other than C and C++. Marek, I tried to follow what we discussed in IRC. Please let me know if I missed something. Joseph, I read your comments on Marek's patch for the same

[PATCH 2/3] improve detection of attribute conflicts (PR 81544)

2017-08-08 Thread Martin Sebor
Part 2 of the series contains the mechanical changes to all the back ends and to front ends other than C and C++. There are no functional changes here. Martin PR c/81544 - attribute noreturn and warn_unused_result on the same function accepted gcc/ChangeLog: PR c/81544 *

[PATCH 0/3] improve detection of attribute conflicts (PR 81544)

2017-08-08 Thread Martin Sebor
This patch series improves the attribute checking infrastructure to make it easy to express mutual exclusivity between attributes, detect and drop conflicting attributes as they are being added to declarations, and help find sources of conflicts when they involve two distinct declarations of the

[PATCH 3/3] diagnose attribute aligned conflicts (PR 81566)

2017-08-08 Thread Martin Sebor
Patch 3 in the series restores the diagnostics for conflicting attribute aligned on the same function (this regressed in r192199 in GCC 4.9), and also makes use of the enhanced infrastructure to enhance the detection of the same conflicts on distinct declarations of the same function. Rather

Re: [PATCH 1/3] improve detection of attribute conflicts (PR 81544)

2017-08-09 Thread Martin Sebor
On 08/09/2017 05:53 AM, Marek Polacek wrote: (Not a proper review really.) On Tue, Aug 08, 2017 at 10:13:07AM -0600, Martin Sebor wrote: @@ -490,7 +583,9 @@ decl_attributes (tree *node, tree attributes, int flags) | (int) ATTR_FLAG_ARRAY_NEXT

[PATCH] fix the handling of string precision in pretty printer (PR 81586)

2017-07-27 Thread Martin Sebor
The pretty printer treats precision in %s directives as a request to print exactly as many characters from the string argument when what precision normally (in C) means is the maximum number of characters to read from the string. It doesn't mean to read past the terminating NUL. The attached

Re: [PATCH] enhance overflow and truncation detection in strncpy and strncat (PR 81117)

2017-08-06 Thread Martin Sebor
On 08/02/2017 10:58 AM, Jeff Law wrote: On 07/31/2017 01:42 PM, Martin Sebor wrote: So I *think* TYPE_SIZE_UNIT isn't necessarily guaranteed to be a INTEGER_CST, it could be a non-constant expression for the size. Are the callers of compute_objsize prepared to handle that? Just to be clear

[PATCH 3/4] enhance overflow and truncation detection in strncpy and strncat (PR 81117)

2017-08-06 Thread Martin Sebor
Part 3 of the series contains the meat of the patch: the new -Wstringop-truncation option, and enhancements to -Wstringop- overflow, and -Wpointer-sizeof-memaccess to detect misuses of strncpy and strncat. Martin PR c/81117 - Improve buffer overflow checking in strncpy gcc/ChangeLog: PR

[PATCH 1/4] enhance overflow and truncation detection in strncpy and strncat (PR 81117)

2017-08-06 Thread Martin Sebor
The attached patch adds support for a new GCC format specifier, G, that behaves like %K but accepts a gcall* argument. This makes it possible to provide inlining context for "artificial" inline functions like strncpy (with _FORTIFY_SOURCE) in diagnostics issued from the middle end. Martin PR

[PATCH 2/4] enhance overflow and truncation detection in strncpy and strncat (PR 81117)

2017-08-06 Thread Martin Sebor
Part 2 of the series adds attribute nostring to annotate arrays of and pointers to char with that are intended to store sequences of characters that aren't necessarily valid (nul-terminated) strings. In the subsequent patch the attribute is relied on to avoid diagnosing strcncpy calls that

[PATCH 4/4] enhance overflow and truncation detection in strncpy and strncat (PR 81117)

2017-08-06 Thread Martin Sebor
For completeness, patch 4 are the (already preapproved) fixups to GCC to let it compile with the -Wstringop-truncation option. I will commit this patch shortly. Martin PR c/81117 - Improve buffer overflow checking in strncpy gcc/ada/ChangeLog: PR c/81117 * adadecode.c (__gnat_decode):

Re: [PATCH 00/22] RFC: integrated 3rd-party static analysis support

2017-08-06 Thread Martin Sebor
On 08/04/2017 04:04 PM, David Malcolm wrote: This patch kit clearly isn't ready yet as-is (see e.g. the "known unknowns" below), but I'm posting it now in the hope of getting early feedback. Summary === This patch kit provides an easy way to make integrate 3rd-party static analysis tools

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-06 Thread Martin Sebor
On 08/03/2017 02:45 AM, Richard Biener wrote: On Wed, Aug 2, 2017 at 7:10 PM, Jeff Law <l...@redhat.com> wrote: On 08/01/2017 03:25 AM, Richard Biener wrote: On Tue, Aug 1, 2017 at 11:23 AM, Richard Biener <richard.guent...@gmail.com> wrote: On Tue, Aug 1, 2017 at 4:27 AM, Marti

Re: [PATCH] detect incompatible aliases (PR c/81854)

2017-08-18 Thread Martin Sebor
On 08/18/2017 10:48 AM, Jonathan Wakely wrote: On 18/08/17 08:54 -0600, Martin Sebor wrote: On 08/18/2017 07:10 AM, Jonathan Wakely wrote: On 17/08/17 21:21 -0600, Martin Sebor wrote: Joseph, while looking into implementing enhancement your request pr81824 I noticed that GCC silently accepts

Re: [PATCH] correct documentation of attribute ifunc (PR 81882)

2017-08-17 Thread Martin Sebor
On 08/17/2017 01:26 PM, Alexander Monakov wrote: On Thu, 17 Aug 2017, Martin Sebor wrote: returns a pointer to the selected implementation function. The implementation functions' declarations must match the API of the -function being implemented, the resolver's declaration is be a -function

[PATCH 4/3] improve detection of attribute conflicts (PR 81544)

2017-08-16 Thread Martin Sebor
Jon, Attached is the libstdc++ only patch to remove the pointless const attribute from __pool::_M_destroy_thread_key(void*). https://gcc.gnu.org/ml/gcc/2017-08/msg00027.html I only belatedly now broke it out of the larger patch under review here:

[PATCH] detect incompatible aliases (PR c/81854)

2017-08-17 Thread Martin Sebor
Joseph, while looking into implementing enhancement your request pr81824 I noticed that GCC silently accepts incompatible alias declarations (pr81854) so as sort of a proof-concept for the former I enhanced the checking already done for other kinds of incompatibilities to also detect those

Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS

2017-08-22 Thread Martin Sebor
On 08/21/2017 07:41 PM, Daniel Santos wrote: It took me a while to figure out how to do this so I figured that it should be in the docs. OK for trunk? * doc/install.texi: Add more details on selecting multiple tests. Thank you! It had taken me some time to figure this out. +The

Re: [PATCH 1/3] improve detection of attribute conflicts (PR 81544)

2017-08-17 Thread Martin Sebor
Attached is an updated patch with just the minor editorial tweaks for the issues pointed out by Marek (stray comments and spaces), and with the C++ and libstdc++ bits removed and posted separately. I also added some text to the manual to clarify the const/pure effects. I thought quite a bit

Re: [PATCH] use strnlen in pretty printer for "%.*s" (PR 81859)

2017-08-17 Thread Martin Sebor
On 08/16/2017 02:55 PM, David Malcolm wrote: On Wed, 2017-08-16 at 10:12 -0600, Martin Sebor wrote: PR c/81859 - [8 Regression] valgrind error from warn_about_normalization gcc/ChangeLog: PR c/81859 * pretty-print.c (pp_format): Use strnlen in %.*s to avoid reading

Re: [PATCH] detect incompatible aliases (PR c/81854)

2017-08-18 Thread Martin Sebor
On 08/18/2017 07:10 AM, Jonathan Wakely wrote: On 17/08/17 21:21 -0600, Martin Sebor wrote: Joseph, while looking into implementing enhancement your request pr81824 I noticed that GCC silently accepts incompatible alias declarations (pr81854) so as sort of a proof-concept for the former I

Re: -Wformat-truncation outputs emtpy lines instead of source

2017-05-02 Thread Martin Sebor
o gcc-help where people who know more about these things than me can help you. Martin Simon Am 02.05.2017 um 01:29 schrieb Martin Sebor: On 05/01/2017 01:39 PM, Simon Sobisch wrote: Hi, I've just got GCC7 (build from svn worked like a charm, even if it took hours but I was warned) and like

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-05-03 Thread Martin Sebor
On 04/30/2017 05:39 PM, Joseph Myers wrote: On Sat, 29 Apr 2017, Martin Sebor wrote: +The safe way to either initialize or "reset" objects of non-trivial Should use TeX quotes in Texinfo files, ``reset''. Heh :) I wrestled with Emacs to get rid of those, It kept replacing my pl

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-05-03 Thread Martin Sebor
On 05/03/2017 08:22 AM, Christophe Lyon wrote: Hi, On 29 April 2017 at 19:56, Andreas Schwab <sch...@linux-m68k.org> wrote: On Apr 28 2017, Martin Sebor <mse...@gmail.com> wrote: +void test_width_and_precision_out_of_range (char *d) +{ +#if __LONG_MAX__ == 2147483647 +# define

Re: [PATCH] handle sprintf(d, "%s", ...) in gimple-ssa-sprintf.c

2017-05-03 Thread Martin Sebor
On 05/03/2017 04:20 AM, Richard Biener wrote: On Tue, May 2, 2017 at 4:41 PM, Martin Sebor <mse...@gmail.com> wrote: FWIW, my fix for bug 79062 is only partial (it gets the pass to run but the warnings are still not issued). I don't quite understand what prevents the warning flag(s

Re: [PATCH 1/7] enhance -Wformat to detect quoting problems (PR 80280 et al.)

2017-05-03 Thread Martin Sebor
On 05/03/2017 09:53 AM, Joseph Myers wrote: On Tue, 2 May 2017, Martin Sebor wrote: In bug 80280 - Missing closing quote (%>) c/semantics.c and c/c-typeck.c, a translator points out one of a number of kinds of cosmetic problems that tend to come up late in development, during translat

Re: [PATCH 1/7] enhance -Wformat to detect quoting problems (PR 80280 et al.)

2017-05-03 Thread Martin Sebor
On 05/03/2017 01:59 PM, Joseph Myers wrote: On Wed, 3 May 2017, Martin Sebor wrote: Use contrib/config-list.mk, with a native compiler with this patch in the PATH, to test building compilers for many configurations. (No doubt you'll also find existing build issues, which may or may

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-05-11 Thread Martin Sebor
I found a few more instances of the warning and a couple of bugs in the fixes for it. The attached update corrects those as well. On 05/11/2017 02:01 PM, Martin Sebor wrote: Attached is revision 2 of the patch that addresses of the feedback I got from Pedro (thanks again). As I explained

Re: [PATCH 2/N] Add dump_flags_type for handling of suboptions.

2017-05-14 Thread Martin Sebor
On 05/12/2017 11:42 AM, Martin Sebor wrote: On 05/05/2017 04:44 AM, Martin Liška wrote: Hi. This one is more interesting as it implements hierarchical option parsing and as a first step I implemented that for optgroup suboptions. I haven't gone through the rest of the patches so I could

Re: [PATCH] handling address mode changes inside extract_bit_field

2017-05-12 Thread Martin Sebor
On 05/04/2017 08:24 PM, Jeff Law wrote: On 03/01/2017 03:06 PM, Jim Wilson wrote: This is a proposed patch for the bug 79794 which I just submitted. This isn't a regression, so this can wait for after the gcc 7 branch if necessary. The problem here is that a reg+offset MEM target is passed to

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-05-11 Thread Martin Sebor
On 04/30/2017 02:02 PM, Pedro Alves wrote: Hi Martin, Thanks much for doing this. A few comments below, in light of my experience doing the equivalent checks in the gdb patch linked below, using standard C++11. Thanks for the feedback! It gave me quite a bit to think about. The challenge

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-05-11 Thread Martin Sebor
On 05/11/2017 10:34 AM, Jakub Jelinek wrote: On Thu, May 11, 2017 at 10:23:48AM -0600, Martin Sebor wrote: Unlike in C, the preferred way to initialize objects in C++ is to use some form of initialization (as opposed to memset). The preferred way to copy objects is using the copy ctor

Re: [1/2] PR 78736: New warning -Wenum-conversion

2017-05-09 Thread Martin Sebor
On 05/09/2017 07:24 AM, Prathamesh Kulkarni wrote: ping https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00161.html Thanks, Prathamesh On 3 May 2017 at 11:30, Prathamesh Kulkarni <prathamesh.kulka...@linaro.org> wrote: On 3 May 2017 at 03:28, Martin Sebor <mse...@gmail.com> wrote: O

Re: PR translation/80280

2017-05-09 Thread Martin Sebor
On 05/09/2017 09:33 AM, Nick Clifton wrote: Hi Martin, Rats! I ran into this when building for sparcv9-solaris2.11 but didn't look at the cause of the error carefully enough to recognize it was caused by my change so I just raised 80673 for it. It didn't occur to me that targets defined

Re: [PATCH] handle enumerated types in -Wformat-overflow (PR 80397)

2017-05-08 Thread Martin Sebor
On 04/28/2017 12:35 PM, Jeff Law wrote: On 04/26/2017 11:05 AM, Martin Sebor wrote: On 04/24/2017 03:35 PM, Jeff Law wrote: On 04/11/2017 12:57 PM, Martin Sebor wrote: In a review of my fix for bug 80364 Jakub pointed out that to determine whether an argument to an integer directive

Re: [1/2] PR 78736: New warning -Wenum-conversion

2017-05-10 Thread Martin Sebor
On 05/10/2017 06:19 AM, Prathamesh Kulkarni wrote: On 9 May 2017 at 23:34, Martin Sebor <mse...@gmail.com> wrote: On 05/09/2017 07:24 AM, Prathamesh Kulkarni wrote: ping https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00161.html Thanks, Prathamesh On 3 May 2017 at 11:30, Prathamesh Ku

Re: [PATCH] prevent -Wno-system-headers from suppressing -Wstringop-overflow (PR 79214)

2017-05-09 Thread Martin Sebor
On 05/09/2017 02:01 PM, Rainer Orth wrote: Andreas Schwab writes: I see these regressions on ia64: FAIL: c-c++-common/Wsizeof-pointer-memaccess2.c -std=gnu++11 (test for excess errors) Excess errors:

[committed] initialize target-specific format_flag_spec members for Cygwin and Solaris

2017-05-09 Thread Martin Sebor
As a result of adding a data member to the format_flag_spec struct my change to enhance -Wformat to warn about poorly quoted GCC diagnostics managed to break bootstrap for the Cygwin and Solaris targets, both of which make use of the struct to define their own printf format extensions. I

Re: [RFC] propagate malloc attribute in ipa-pure-const pass

2017-05-17 Thread Martin Sebor
The patch passes bootstrap+test on x86_64 and found a few functions in the source tree (attached func_names.txt) that could be annotated with malloc (I gave a brief look at some of the functions and didn't appear to be false positives but I will recheck thoroughly) virtual char*

[PATCH] add more detail to -Wconversion and -Woverflow (PR 80731)

2017-05-17 Thread Martin Sebor
While working on a new warning for unsafe conversion I noticed that the existing warnings that diagnose these kinds of problems are missing some useful detail. For example, given declarations of an integer Type and an integer Constant defined in some header, a C programmer who writes this

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-15 Thread Martin Sebor
So how about the following then? I stayed with the catch part and added a parameter to the warning to let the user decide on the warnings she/he wants to get: -Wcatch-value=n. -Wcatch-value=1 only warns for polymorphic classes that are caught by value (to avoid slicing), -Wcatch-value=2 warns for

Re: [PATCH] handle enumerated types in -Wformat-overflow (PR 80397)

2017-05-15 Thread Martin Sebor
Ping: Jeff, is this patch approved? https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00547.html On 05/08/2017 08:38 PM, Martin Sebor wrote: On 04/28/2017 12:35 PM, Jeff Law wrote: On 04/26/2017 11:05 AM, Martin Sebor wrote: On 04/24/2017 03:35 PM, Jeff Law wrote: On 04/11/2017 12:57 PM

Re: [PATCH] disable -Walloc-size-larger-than and -Wstringop-overflow for non-C front ends (PR 80545)

2017-05-09 Thread Martin Sebor
On 05/09/2017 02:57 AM, Richard Biener wrote: On Mon, May 8, 2017 at 4:31 PM, Martin Sebor <mse...@gmail.com> wrote: On 05/04/2017 10:13 PM, Jeff Law wrote: On 04/28/2017 04:02 PM, Martin Sebor wrote: The two options were included in -Wall and enabled for all front ends but onl

Re: PR translation/80280

2017-05-09 Thread Martin Sebor
On 05/09/2017 09:08 AM, Nick Clifton wrote: Hi Martin, I am currently unable to build gcc for the x86_64-pc-cygwin target because gcc/config/i386/msformat-c.c uses the format_flag_spec struct but it has not been updated with the new field. :-( For example:

Re: [PATCH] warn on mem calls modifying objects of non-trivial types (PR 80560)

2017-05-11 Thread Martin Sebor
Attached is revision 2 of the patch that addresses of the feedback I got from Pedro (thanks again). As I explained in my response (https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00925.html) it's not entirely practical to rely on the strict interpretation of the C++ definition of type triviality

Re: [PATCH 2/N] Add dump_flags_type for handling of suboptions.

2017-05-12 Thread Martin Sebor
On 05/05/2017 04:44 AM, Martin Liška wrote: Hi. This one is more interesting as it implements hierarchical option parsing and as a first step I implemented that for optgroup suboptions. I haven't gone through the rest of the patches so I could be missing some context. But I have a few

Re: [committed] Fix -Werror=class-memaccess failures in jit testsuite (PR jit/81144)

2017-06-20 Thread Martin Sebor
On 06/20/2017 03:25 PM, David Malcolm wrote: This patch fixes a couple of failures of the form: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct quadratic_test'; use assignment or value-initialization instead [-Werror=class-memaccess] note:

Re: [PATCH 3/6] New warnings -Wstring-plus-{char, int} (PR c++/62181)

2017-06-19 Thread Martin Sebor
On 06/11/2017 07:34 PM, Xi Ruoyao wrote: This patch adds warning option -Wstring-plus-char for C/C++. +void +warn_if_string_plus_char (location_t loc, tree ptrtype, tree inttype) +{ + if (POINTER_TYPE_P (ptrtype) + && type_main_variant_is_char (TREE_TYPE (ptrtype)) + &&

Re: [PATCH 6/6] New warnings -Wstring-plus-{char, int} (PR c++/62181)

2017-06-19 Thread Martin Sebor
On 06/11/2017 07:39 PM, Xi Ruoyao wrote: This patch adds document of -Wstring-plus-int and -Wstring-plus-char. +@item -Wstring-plus-char +@opindex Wstring-plus-char +@opindex Wno-string-plus-char +Warn for adding a character to a string pointer, which seems like a failed +attempt to append to

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-22 Thread Martin Sebor
On 06/22/2017 06:16 AM, Richard Sandiford wrote: Aldy Hernandez <al...@redhat.com> writes: On 06/20/2017 10:59 AM, Martin Sebor wrote: On 06/20/2017 02:41 AM, Aldy Hernandez wrote: On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: + void

[PATCH] consider casts in -Wclass-memaccess (PR c++/81169)

2017-06-22 Thread Martin Sebor
By making use of STRIP_NOPS() on the destination of the memory function call, besides discarding the (implicit) conversion to void* the warning also strips any explicit casts that remove cv-qualifiers. This causes warnings that should otherwise be suppressed, as pointed out in bug 81169. The

Re: [committed] Fix -Werror=class-memaccess failures in jit testsuite (PR jit/81144)

2017-06-23 Thread Martin Sebor
On 06/20/2017 06:54 PM, David Malcolm wrote: On Tue, 2017-06-20 at 17:15 -0600, Martin Sebor wrote: On 06/20/2017 03:25 PM, David Malcolm wrote: This patch fixes a couple of failures of the form: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct

Re: [PATCH][Testsuite] Use user defined memmove in gcc.c-torture/execute/builtins/memops-asm-lib.c

2017-06-23 Thread Martin Sebor
On 06/23/2017 03:19 AM, Renlin Li wrote: Hi all, After the change r249278. bcopy is folded into memmove. And in newlib aarch64 memmove implementation, it will call memcpy in certain conditions. The memcpy defined in memops-asm-lib.c will abort when the test is running. In this case, I defined

Re: C/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

2017-06-26 Thread Martin Sebor
On 06/23/2017 08:46 AM, Marek Polacek wrote: This patch adds a variant of __typeof, called __typeof_noqual. As the name suggests, this variant always drops all qualifiers, not just when the type is atomic. This was discussed several times in the past, see e.g.

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-20 Thread Martin Sebor
On 06/20/2017 02:41 AM, Aldy Hernandez wrote: On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: + void Union (wide_int x, wide_int y); + bool Union (const irange ); + bool Union (const irange , const irange ); + + // THIS = THIS ^ [X,Y]. Return

Re: [PATCH 0/6] New warnings -Wstring-plus-{char, int} (PR c++/62181)

2017-06-19 Thread Martin Sebor
On 06/11/2017 07:26 PM, Xi Ruoyao wrote: Hi, I've implemented -Wstring-plus-int and -Wstring-plus-char (like their counterpart in Clang) for GCC. From the Clang patch(*) it only "warns when a character literal is added (using '+') to a variable with type 'char *' (or any other pointer to

Re: [PATCH 2/6] New warnings -Wstring-plus-{char, int} (PR c++/62181)

2017-06-19 Thread Martin Sebor
On 06/11/2017 07:32 PM, Xi Ruoyao wrote: This patch adds warning option -Wstring-plus-int for C/C++. gcc/ChangeLog: 2017-06-12 Xi Ruoyao * c-family/c.opt: New option -Wstring-plus-int. * c-family/c-common.c (pointer_int_sum): Checking for

Re: [PATCH] Improved diagnostics for casts and enums

2017-06-20 Thread Martin Sebor
So here's the patch that reverts the special enum handling in type_to_string and uses %q#T instead of %qT for two casting-related diagnostics. Bootstrapped and regtested on x86_64-pc-linux-gnu. OK for trunk? The "E {enum}'" notation is still on trunk so it seems that this patch has never been

Re: [PATCH 2/6] New warnings -Wstring-plus-{char, int} (PR c++/62181)

2017-06-19 Thread Martin Sebor
On 06/19/2017 11:28 AM, Xi Ruoyao wrote: On 2017-06-19 10:51 -0600, Martin Sebor wrote: On 06/11/2017 07:32 PM, Xi Ruoyao wrote: This patch adds warning option -Wstring-plus-int for C/C++. gcc/ChangeLog: 2017-06-12 Xi Ruoyao <r...@stu.xidian.edu.cn> * c-family/c.opt: New

Re: [PATCH 2/2] [MSP430] Fix issues handling .persistent attribute (PR 78818)

2017-05-18 Thread Martin Sebor
On 05/17/2017 09:45 AM, Jozef Lawrynowicz wrote: Add warning to back end and add test. Patch is attached. If the patch is acceptable, I would appreciate if someone could commit it for me as I do not have write access. 2017-05-XX Jozef Lawrynowicz gcc/ PR

[PING][PATCH] add more detail to -Wconversion and -Woverflow (PR 80731)

2017-05-22 Thread Martin Sebor
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01428.html On 05/17/2017 06:04 PM, Martin Sebor wrote: While working on a new warning for unsafe conversion I noticed that the existing warnings that diagnose these kinds of problems are missing some useful detail. For example, given

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Martin Sebor
--- /dev/null +++ b/gcc/range.h + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RANGE_H +#define GCC_RANGE_H +#define MAX_RANGES 6 + +typedef class irange *irange_p;

<    7   8   9   10   11   12   13   14   15   16   >