[PATCH] have chkp skip flexible member arrays (PR #79986)

2017-03-20 Thread Martin Sebor
Attached is a minimal patch to avoid an ICE in CHKP upon encountering one form of an initializer for a flexible array member, specifically the empty string: int f () { struct B { int n; char a[]; }; return ((struct B){ 1, "" }).a[0]; } Although GCC accepts (and doesn't ICE on)

Re: [PATCH] have chkp skip flexible member arrays (PR #79986)

2017-03-20 Thread Martin Sebor
On 03/20/2017 05:51 PM, Jason Merrill wrote: On Mon, Mar 20, 2017 at 7:04 PM, Martin Sebor <mse...@gmail.com> wrote: Attached is a minimal patch to avoid an ICE in CHKP upon encountering one form of an initializer for a flexible array member, specifically the empty string:

Re: [wwwdocs] Document in changes.html -fcode-hoisting, -fipa-bit-cp, -fipa-vrp, -fsplit-loops, GCJ removal, x86 ISA additions, -fshrink-wrap-separate etc.

2017-03-14 Thread Martin Sebor
On 03/12/2017 05:23 PM, Gerald Pfeifer wrote: Hi Martin, On Mon, 27 Feb 2017, Martin Sebor wrote: Sorry to be jumping in so late. I only noticed this bit now. I would suggest to say that these new built-ins evaluate to integer constant expressions when their arguments do. Not all C

[PATCH doc] use "cannot" consistently

2017-03-14 Thread Martin Sebor
In formal writing it's recommended to prefer the word "cannot" to the somewhat informal "can't." The GCC manual uses "cannot" in most places (280 lines) but there are a few instances of "can't" (33 lines). The attached patch replaces the informal "can't" with the former for consistency. Thanks

[PATCH C++] document order of C++ ctors and attribute constructor is unspecified

2017-03-15 Thread Martin Sebor
In bug 52477 - Wrong initialization order? attribute constructor vs static data access, the reporter expects C++ objects with static storage duration to have their ctors called in the same order as those of functions declared with attribute constructor interleaved with them. In his comment on

Re: [PATCH doc] use "cannot" consistently

2017-03-15 Thread Martin Sebor
On 03/15/2017 05:00 AM, Richard Kenner wrote: First, I agree that the less formal language is becoming more acceptable. Some style guides explicitly allow contractions, but others advise against them. The technical specifications that significant parts of GCC aim to conform to, and those I

Re: [PATCH doc] use "cannot" consistently

2017-03-15 Thread Martin Sebor
On 03/15/2017 09:40 AM, Martin Sebor wrote: On 03/15/2017 05:00 AM, Richard Kenner wrote: First, I agree that the less formal language is becoming more acceptable. Some style guides explicitly allow contractions, but others advise against them. The technical specifications that significant

Re: [PATCH] Wrap a macro in do {} while (0) (PR sanitizer/80063)

2017-03-20 Thread Martin Sebor
On 03/20/2017 10:53 AM, Jakub Jelinek wrote: On Mon, Mar 20, 2017 at 10:44:25AM -0600, Martin Sebor wrote: /home/marek/src/gcc/gcc/sanitizer.def:459:1: note: in expansion of macro ‘DEF_SANITIZER_BUILTIN’ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT I would view

Re: [PATCH] Wrap a macro in do {} while (0) (PR sanitizer/80063)

2017-03-20 Thread Martin Sebor
On 03/20/2017 07:42 AM, Marek Polacek wrote: On Mon, Mar 20, 2017 at 09:37:10AM -0400, Jason Merrill wrote: On Mon, Mar 20, 2017 at 9:28 AM, Marek Polacek wrote: #define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \ + do {

Re: [PATCH] restore -Wunused-variable on a typedef'd variable in a function template (PR 79548)

2017-03-21 Thread Martin Sebor
I'm not 100% sure I understand what changes you're suggesting but the attached patch does what I think you're after. Is that what you had in mind? Looks good. Thanks. I just committed it to trunk but forgot to ask for approval to backport it to 6 and 5. Martin

Re: [PATCH] have chkp skip flexible member arrays (PR #79986)

2017-03-21 Thread Martin Sebor
Since I've also spent some time on this: my take on this is that the C++ FE should just follow C FE's suit and reject such initializations where possible; it seems they've never worked reliably anyway, and bring more harm than good. I don't see that rejecting such code would cause too much

Re: [PATCH doc] use "cannot" consistently

2017-03-14 Thread Martin Sebor
On 03/14/2017 01:41 PM, Richard Sandiford wrote: Martin Sebor <mse...@gmail.com> writes: @@ -373,7 +373,7 @@ example, this code would produce an error: @smallexample #if 0 -You can't expect this to work. +You cannot expect this to work. #endif @end smallexample Sure the maint

Re: [PATCH doc] use "cannot" consistently

2017-03-14 Thread Martin Sebor
On 03/14/2017 02:53 PM, Richard Kenner wrote: The GCC manual uses "cannot" in most places (280 lines) but there are a few instances of "can't" (33 lines). The attached patch replaces the informal "can't" with the former for consistency. In my opinion, this is the wrong direction.

[PATCH] avoid relying on getcwd extensions (PR 80047)

2017-03-15 Thread Martin Sebor
PR 80047 - fixincludes/fixincl.c: PVS-Studio: Improper Release of Memory Before Removing Last Reference (CWE-401) points out that the fixincludes program calls getcwd with the first argument set to NULL, apparently a Glibc extension, to have the function allocate the memory to which it then

Re: [PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-10 Thread Martin Sebor
@@ -972,11 +972,11 @@ get_int_range (tree arg, tree type, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax, if (range_type == VR_RANGE) { HOST_WIDE_INT type_min - = (TYPE_UNSIGNED (type) - ? tree_to_uhwi (TYPE_MIN_VALUE (type)) -

[committed] Adjust dg-bogus pattern to match the text of changed diagnostic

2017-04-10 Thread Martin Sebor
tsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ +2017-04-10 Martin Sebor <mse...@redhat.com> + + * gcc.dg/pr40340-3.c: Adjust directive pattern. + * gcc.dg/pr40340-4.c: Same. + 2017-04-10 Nicolas Koenig <koeni...@student.ethz.ch> - PR fortran/69498

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

2017-04-11 Thread Martin Sebor
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 to INTEGER_TYPE when it should instead be using INTEGRAL_TYPE_P(). This has the effect of the

Re: [PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-11 Thread Martin Sebor
if (TREE_CODE (arg) == SSA_NAME - && TREE_CODE (type) == INTEGER_TYPE) + && TREE_CODE (argtype) == INTEGER_TYPE I think you want && INTEGRAL_TYPE_P (argtype) here instead of that last line, the middle-end considers conversions between integral types useless

Re: [PATCH] [gcc, testsuite] Don't xfail on s390.

2017-03-31 Thread Martin Sebor
On 03/29/2017 04:23 AM, Dominik Vogt wrote: The attached patch removes the XFAIL in attr-alloc_size-11.c on s390. (PR 79356). https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79356 Untested. It looks like the only target the test does fail on is x86. The attached patch simplifies the test to

[PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-09 Thread Martin Sebor
Bug 80364 - sanitizer detects signed integer overflow in gimple-ssa-sprintf.c, points out a runtime error (integer overflow when negating LONG_MIN) triggered by the undefined saniziter for an invalid test case recently added to the test suite. The test case passes an argument of type long as the

Re: port contrib/download_prerequisites script to macOS

2017-04-12 Thread Martin Sebor
On 04/12/2017 04:03 PM, Jeff Law wrote: On 04/04/2017 07:10 PM, Damian Rouson wrote: All, The attached patch modifies the contrib/download_prerequisites script to work on macOS. The revised script detects the operating system and adjusts the shasum and md5 commands to their expected name and

[PATCH] warn for reading past the end by library functions (PR 54924, 79234)

2017-04-20 Thread Martin Sebor
PR libstdc++/54924 - Warn for std::string constructor with wrong size asks for a warning when constructing a std::string from a character array and a number of elements that's in excess of the number of elements. E.g., std::string s ("abc", 7); PR middle-end/79234 - warn on past the end

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

2017-04-21 Thread Martin Sebor
nce to validate them. The attached patch moves the transformation from gimple-fold.c into the gimple-ssa-sprintf.c pass, thus allowing the calls to be validated. Only valid calls (i.e., those that do not overflow the destination) are transformed. Martin commit 2cd98763984ffb93606ee96ad658733b4c95c1e4

Re: [PATCH 1/7] Add missing punctuation to message (PR driver/79875)

2017-03-09 Thread Martin Sebor
On 03/09/2017 10:45 AM, David Malcolm wrote: gcc/ChangeLog: PR driver/79875 * opts.c (parse_sanitizer_options): Add missing question mark to "did you mean" message. --- gcc/opts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/opts.c b/gcc/opts.c

Re: [PATCH 6/7] i386.c: make "sorry" message more amenable to translation (PR target/79926)

2017-03-09 Thread Martin Sebor
On 03/09/2017 10:45 AM, David Malcolm wrote: PR target/79926 notes that in: sorry ("%s instructions aren't allowed in %s service routine", isa, (cfun->machine->func_type == TYPE_EXCEPTION ? "exception" : "interrupt")); the text from the second %s won't be

[PATCH] correct aligned_alloc argument order (PR 80020)

2017-03-12 Thread Martin Sebor
r243470 decorates standard allocation functions like alloca and malloc with attribute alloc_size. However, in applying the attribute to aligned_alloc I had overlooked that the size argument is the second one and not the first. That oversight has led to __builtin_object_size() reporting the

Re: [PATCH 1/5] testsuite: attr-alloc_size-11.c (PR79356)

2017-03-12 Thread Martin Sebor
On 03/10/2017 10:51 PM, Jeff Law wrote: On 03/10/2017 09:20 AM, Martin Sebor wrote: On 03/10/2017 05:57 AM, Rainer Orth wrote: Hi Segher, On Fri, Feb 10, 2017 at 11:56:39AM +0100, Rainer Orth wrote: Segher Boessenkool <seg...@kernel.crashing.org> writes: As stated in the PR, this te

Re: [PATCH 1/5] testsuite: attr-alloc_size-11.c (PR79356)

2017-03-10 Thread Martin Sebor
On 03/10/2017 05:57 AM, Rainer Orth wrote: Hi Segher, On Fri, Feb 10, 2017 at 11:56:39AM +0100, Rainer Orth wrote: Segher Boessenkool writes: As stated in the PR, this test now passes on aarch64, ia64, powerpc, and s390x. This patch disables the xfails for

Re: [PATCH] add calls.c to GTFILES in Makefile.in (PR 79936)

2017-03-13 Thread Martin Sebor
Ping: this a P3 regression targeted at 7.0.1. It was found on x86_64-apple-darwin10.8.0 but affects all targets (even if it doesn't happen to manifest on them): https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00342.html On 03/07/2017 06:03 PM, Martin Sebor wrote: In bug 79936 - ICE

[PATCH] correct handling of negative-positive precision ranges with floating directives (PR 79800)

2017-03-13 Thread Martin Sebor
The output of a floating point directive whose precision is specified by an asterisk with an argument that's in a range that includes both negative and positive values less than six may include between zero and six fractional digits plus a decimal point. For example, printf ("%.*e", p, x);

Re: terminology: zero character vs. null character

2017-03-14 Thread Martin Sebor
On 03/13/2017 04:34 PM, Bruce Korb wrote: On 03/13/17 15:02, Gerald Pfeifer wrote: On Mon, 13 Mar 2017, Joseph Myers wrote: I am currently translating GCC into German. During that, I noticed that in some places the term "zero character" means '\0'. The official term though is "null character",

Re: [PATCH] free MPFR caches in gimple-ssa-sprintf.c (PR 79699)

2017-03-02 Thread Martin Sebor
On 03/02/2017 02:40 PM, Andrew Pinski wrote: On Thu, Mar 2, 2017 at 1:33 PM, Martin Sebor <mse...@gmail.com> wrote: On 03/02/2017 01:08 AM, Richard Biener wrote: On Thu, Mar 2, 2017 at 2:01 AM, Joseph Myers <jos...@codesourcery.com> wrote: On Wed, 1 Mar 2017, Martin Sebor wro

Re: [PATCH docs] remove Java from GCC 7 release criteria

2017-03-02 Thread Martin Sebor
On 03/02/2017 12:58 AM, Richard Biener wrote: On Wed, 1 Mar 2017, Martin Sebor wrote: On 02/28/2017 11:41 PM, Richard Biener wrote: On March 1, 2017 3:34:46 AM GMT+01:00, Martin Sebor <mse...@gmail.com> wrote: On 02/28/2017 01:41 PM, Richard Biener wrote: On February 28, 2017 7:00:39

Re: [PATCH] free MPFR caches in gimple-ssa-sprintf.c (PR 79699)

2017-03-02 Thread Martin Sebor
On 03/02/2017 01:08 AM, Richard Biener wrote: On Thu, Mar 2, 2017 at 2:01 AM, Joseph Myers <jos...@codesourcery.com> wrote: On Wed, 1 Mar 2017, Martin Sebor wrote: Joseph, since you commented on the bug, do you have a suggestion for a different site for it or a guard? The only othe

[PATCH] add calls.c to GTFILES in Makefile.in

2017-03-07 Thread Martin Sebor
In bug 79936 - ICE with -Walloc-size-larger-than=32767 the reporter encountered an ICE on x86_64-apple-darwin10.8.0 caused by GCC source file that implements the warning accessing a global tree without having included the file in GTFILES make variable. (Thanks again to David Malcolm who helped

[PATCH] fix error spelling in nds32.c (PR 79928)

2017-03-07 Thread Martin Sebor
The following one-line patch corrects the spelling of the error message in the nds32 back end pointed out by a translator. I'll go ahead and commit it as trivial unless there are objections in the next day or so. Martin 2017-03-07 Martin Sebor <mse...@redhat.com> * gcc/config

Re: [PATCH] have chkp skip flexible member arrays (PR #79986)

2017-03-21 Thread Martin Sebor
On 03/20/2017 10:27 PM, Jason Merrill wrote: On Mon, Mar 20, 2017 at 7:58 PM, Martin Sebor <mse...@gmail.com> wrote: On 03/20/2017 05:51 PM, Jason Merrill wrote: On Mon, Mar 20, 2017 at 7:04 PM, Martin Sebor <mse...@gmail.com> wrote: Attached is a minimal patch to avoid an ICE

Re: port contrib/download_prerequisites script to macOS

2017-04-17 Thread Martin Sebor
On 04/13/2017 05:29 PM, Damian Rouson wrote: Resending as plain text: On April 12, 2017 at 3:03:19 PM, Jeff Law (l...@redhat.com(mailto:l...@redhat.com)) wrote: > > > > 2017-04-05 Damian Rouson > > > > * download_prerequisites (md5_check): New function emulates Linux > > 'md5 --check'

Re: Let tree_single_nonzero_warnv_p use VRP

2017-04-24 Thread Martin Sebor
On 04/23/2017 03:38 PM, Marc Glisse wrote: Hello, this patches teaches tree_expr_nonzero_warnv_p to handle SSA_NAME using range information and known (non-)zero bits, by delegating to expr_not_equal_to which already knows how to handle all that. This makes one strict overflow warning

[PATCH] avoid assuming all integers are representable in HOST_WIDE_INT (PR #80497)

2017-04-24 Thread Martin Sebor
Bug 80497 brings to light that my fix for PR 80364 where I corrected the handling for int128_t was incomplete. I handled the non-constant case but missed the INTEGER_CST case just a few lines above. The attached patch also corrects that problem plus one more elsewhere in the pass. Both of the

Re: C PATCH to further improve diagnostic for -Wsign-compare (PR c/81417)

2017-07-31 Thread Martin Sebor
On 07/31/2017 08:14 AM, Marek Polacek wrote: This patch improves the diagnostic of -Wsign-compare for ?: by also printing the types, similarly to my recent patch. But we can do even better here if we actually point to the operand in question, so I passed the locations of the operands from the

Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers'

2017-07-28 Thread Martin Sebor
On 07/27/2017 01:13 PM, Richard Sandiford wrote: Martin Sebor <mse...@gmail.com> writes: On 07/23/2017 02:42 PM, Volker Reichelt wrote: On 21 Jul, Martin Sebor wrote: On 07/20/2017 10:35 AM, Volker Reichelt wrote: Hi, the following patch introduces a new C++ warning option -Wdupl

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

2017-07-31 Thread Martin Sebor
On 07/27/2017 02:30 AM, tbsaunde+...@tbsaunde.org wrote: From: Trevor Saunders The preC++ way of passing information about the call site of a function was to use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with the same name with _stat

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

2017-07-31 Thread Martin Sebor
So I think the fixes exposed by the new warning are OK to go in as-is immediately if you wish to do so. Minor questions on the actual improved warnings inline. Sure, thanks. -static inline tree +static tree compute_objsize (tree dest, int ostype) { ... + type = TYPE_MAIN_VARIANT

Re: C PATCH to further improve diagnostic for -Wsign-compare (PR c/81417)

2017-07-31 Thread Martin Sebor
On 07/31/2017 10:05 AM, Marek Polacek wrote: On Mon, Jul 31, 2017 at 09:54:03AM -0600, Martin Sebor wrote: On 07/31/2017 08:14 AM, Marek Polacek wrote: This patch improves the diagnostic of -Wsign-compare for ?: by also printing the types, similarly to my recent patch. But we can do even

Re: C PATCH to further improve diagnostic for -Wsign-compare (PR c/81417)

2017-08-01 Thread Martin Sebor
I'm wondering if the messages could use a slight rewording, to give a clue to the user about the reason *why* the expression has changed signedness. The old message "signed and unsigned type in conditional expression" gave the clue (but failed to underline the subexpression changing sign, and

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

2017-08-02 Thread Martin Sebor
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 and survives regression tests. Ready to be installed? Martin gcc/ChangeLog: 2017-07-13 Martin

[PATCH] minor readability tweaks to print_node

2017-08-01 Thread Martin Sebor
This is a small readability tweak to the tree printer to have it consistently use dashes and colons in tree attribute names in favor of spaces. It's been tested on x86_64-linux. The tree printer tends to avoid using spaces to separate tree attribute names (not the __attribute__ kind but things

Re: [Bug web/?????] New: Fwd: failure notice: Bugzilla down.

2017-08-15 Thread Martin Sebor
On 08/15/2017 07:27 AM, Jonathan Wakely wrote: On 15 August 2017 at 04:10, Martin Sebor wrote: On 08/14/2017 04:22 PM, Eric Gallager wrote: I'm emailing this manually to the list because Bugzilla is down and I can't file a bug on Bugzilla about Bugzilla being down. The error message looks

Re: [Bug web/?????] New: Fwd: failure notice: Bugzilla down.

2017-08-15 Thread Martin Sebor
On 08/15/2017 10:27 AM, Joseph Myers wrote: On Tue, 15 Aug 2017, Martin Sebor wrote: It looks like the data loss extends beyond 8/14. Bug 81840 was created Sunday afternoon but is not in the database: https://gcc.gnu.org/ml/gcc-bugs/2017-08/msg01303.html (Strangely, 81841

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

2017-08-16 Thread Martin Sebor
Bug 81859 points out that my fix for bug 81586 wasn't quite right (or complete): the argument of a %.*s directive need not be a nul-terminated string when the precision is less than the initialized size of the array the argument points to. The attached tweak uses strnlen to avoid reading past

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

2017-08-14 Thread Martin Sebor
On 08/14/2017 12:09 PM, Joseph Myers wrote: On Mon, 14 Aug 2017, Martin Sebor wrote: I assumed every attribute needed to define an identifier but nothing broke after I removed it so it looks like you're right variable attributes don't need one. Go figure. It would be nice

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

2017-08-14 Thread Martin Sebor
On 08/14/2017 01:50 PM, Joseph Myers wrote: On Mon, 14 Aug 2017, Martin Sebor wrote: /* This header provides a declarative way of describing the attributes - that are applied to some functions by default. + that are applied to some built-in functions by default. Attributes + that apply

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

2017-08-14 Thread Martin Sebor
On 08/09/2017 10:44 PM, Jeff Law wrote: On 08/06/2017 02:07 PM, Martin Sebor wrote: 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 func

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

2017-08-14 Thread Martin Sebor
On 08/10/2017 01:29 PM, Martin Sebor wrote: diff --git a/gcc/builtins.c b/gcc/builtins.c index 016f68d..1aa9e22 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c [ ... ] + + if (TREE_CODE (type) == ARRAY_TYPE) +{ + /* Return the constant size unless it's zero (that's a zero-length

Re: [Bug web/?????] New: Fwd: failure notice: Bugzilla down.

2017-08-14 Thread Martin Sebor
On 08/14/2017 04:22 PM, Eric Gallager wrote: I'm emailing this manually to the list because Bugzilla is down and I can't file a bug on Bugzilla about Bugzilla being down. The error message looks like this: Bugzilla and the rest of gcc.gnu.org have been down much of the afternoon/evening due to

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

2017-08-09 Thread Martin Sebor
On 08/09/2017 01:55 PM, Joseph Myers wrote: On Wed, 9 Aug 2017, Martin Sebor wrote: the same function with the other of this pair attributes. I'd also be okay with not diagnosing this combination if I could convince myself that it's safe (or can be made safe) and treated consistently. I'd

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

2017-08-11 Thread Martin Sebor
On 08/10/2017 03:55 PM, Joseph Myers wrote: On Wed, 9 Aug 2017, Martin Sebor wrote: The problem isn't that the declarations aren't merged at the call site but rather that the middle-end gives const precedence over pure so when both attributes are provided the former wins. But that precedence

Re: [PATCH, rs6000] More diagnostic cleanup, addressing PR79845

2017-08-13 Thread Martin Sebor
--- gcc/config/rs6000/rs6000-c.c(revision 250965) +++ gcc/config/rs6000/rs6000-c.c(working copy) @@ -5812,7 +5812,7 @@ altivec_resolve_overloaded_builtin (location_t loc types. */ if (nargs != 2) { - error ("vec_mul only accepts 2 arguments"); +

[committed] remove stray space from a warning message (PR 79998)

2017-08-14 Thread Martin Sebor
The trivial tweak below removes the spurious space pointed out in bug 79998 - typo in diagnostic "specified bound %wu". The patch has been committed in r251096. Martin Index: gcc/gimple-ssa-sprintf.c === ---

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

2017-08-14 Thread Martin Sebor
On 08/09/2017 11:00 PM, Jeff Law wrote: On 08/06/2017 02:07 PM, Martin Sebor wrote: 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

[PATCH 5/3] C++ bits to improve detection of attribute conflicts (PR 81544)

2017-08-16 Thread Martin Sebor
To make review easier I broke out the C++ changes for the attributes work into a patch of their own. I also found the API I had asked about, to look up a declaration based on one that's about to be added/merged. This patch depends on the foundation bits posted here:

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

2017-08-10 Thread Martin Sebor
diff --git a/gcc/builtins.c b/gcc/builtins.c index 016f68d..1aa9e22 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c [ ... ] + + if (TREE_CODE (type) == ARRAY_TYPE) +{ + /* Return the constant size unless it's zero (that's a zero-length +array likely at the end of a struct).

[PATCH] document IntegerRange in internals manual

2017-07-07 Thread Martin Sebor
A conflict in my patch for bug 81345 made me notice that r249734 recently added a new option property, IntegerRange. The change below adds brief documentation of the property to the manual. Martin, can you please check to make sure I didn't miss anything? Btw., while experimenting with the

Re: C PATCH to display types when printing a conversion warning (PR c/81233)

2017-07-13 Thread Martin Sebor
On 07/13/2017 08:18 AM, Marek Polacek wrote: This patch improves diagnostic in the C FE by printing the types when reporting a problem with a conversion. E.g., instead of warning: assignment from incompatible pointer type you'll now get warning: assignment to 'int *' from incompatible

Re: [PATCH] gcc/doc: list what version each attribute was introduced in

2017-07-17 Thread Martin Sebor
On 07/06/2017 07:25 AM, Daniel P. Berrange wrote: There are several hundred named attribute keys that have been introduced over many GCC releases. Applications typically need to be compilable with multiple GCC versions, so it is important for developers to know when GCC introduced support for

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

2017-07-17 Thread Martin Sebor
On 07/10/2017 05:27 PM, Joseph Myers wrote: On Mon, 10 Jul 2017, Martin Sebor wrote: On 07/07/2017 10:58 AM, Joseph Myers wrote: This patch is OK. Thanks. Committed in r250104. Do you have any comments on or concerns with changing how LangEnabledBy interprets the opt argument as I

Re: [PATCH] document IntegerRange in internals manual

2017-07-11 Thread Martin Sebor
On 07/11/2017 07:32 AM, Martin Liška wrote: On 07/10/2017 05:08 PM, Martin Sebor wrote: On 07/10/2017 02:35 AM, Martin Liška wrote: On 07/07/2017 09:20 PM, Martin Sebor wrote: A conflict in my patch for bug 81345 made me notice that r249734 recently added a new option property, IntegerRange

Re: [PATCH 0/3] C/C++: show pertinent open token when missing a close token

2017-07-11 Thread Martin Sebor
On 07/11/2017 09:24 AM, David Malcolm wrote: [This patch kit is effectively just one patch; I've split it up into 3 parts, in the hope of making it easier to review: the c-family parts, the C parts, and the C++ parts] This patch adds a hint to the user to various errors generated in the C

Re: [PATCH 0/3] C/C++: show pertinent open token when missing a close token

2017-07-11 Thread Martin Sebor
On 07/11/2017 12:32 PM, David Malcolm wrote: On Tue, 2017-07-11 at 11:28 -0600, Martin Sebor wrote: On 07/11/2017 09:24 AM, David Malcolm wrote: [This patch kit is effectively just one patch; I've split it up into 3 parts, in the hope of making it easier to review: the c-family parts, the C

Re: [PATCH] Add quotes to error messages related to Sanitizers.

2017-07-10 Thread Martin Sebor
On 07/10/2017 03:36 AM, Martin Liška wrote: Hi. This adds missing quotes to various error messages related to AddressSanitizer. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin gcc/ChangeLog: 2017-07-04 Martin Liska

[PING #2] [PATCH] Improved diagnostics for casts and enums

2017-07-10 Thread Martin Sebor
to type ‘struct S’ [-Wuseless-cast] rather than just warning: useless cast to type ‘S’ [-Wuseless-cast] as it still does now. More broadly, I wonder if types should always (or by default) include the class-key or enum keyword in C++? In C? Martin On 06/20/2017 10:09 AM, Martin Sebor wrote: So

Re: [PATCH] document IntegerRange in internals manual

2017-07-10 Thread Martin Sebor
On 07/10/2017 02:35 AM, Martin Liška wrote: On 07/07/2017 09:20 PM, Martin Sebor wrote: A conflict in my patch for bug 81345 made me notice that r249734 recently added a new option property, IntegerRange. The change below adds brief documentation of the property to the manual. Martin, can you

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

2017-07-10 Thread Martin Sebor
On 07/07/2017 10:58 AM, Joseph Myers wrote: This patch is OK. Thanks. Committed in r250104. Do you have any comments on or concerns with changing how LangEnabledBy interprets the opt argument as I suggested below? IMO, it makes little sense for an option that takes an argument and that

[PING] [PATCH] enhance -Wrestrict for sprintf %s arguments

2017-07-10 Thread Martin Sebor
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00036.html On 07/02/2017 02:00 PM, Martin Sebor wrote: 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

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

2017-07-08 Thread Martin Sebor
PR 81117 asks for improved detection of common misuses(*) of strncpy and strncat. The attached patch is my solution. It consists of three related sets of changes: 1) Adds a new option, -Wstringop-truncation, that diagnoses calls to strncpy, and stpncpy (and also strncat) that truncate the

Re: [PATCH 3/3] matching tokens: C++ parts

2017-07-12 Thread Martin Sebor
On 07/12/2017 07:13 AM, Trevor Saunders wrote: On Tue, Jul 11, 2017 at 11:24:45AM -0400, David Malcolm wrote: +/* Some tokens naturally come in pairs e.g.'(' and ')'. + This class is for tracking such a matching pair of symbols. + In particular, it tracks the location of the first token, +

Re: [PING] C++ Re: [PATCH] C/C++: fix quoting of "aka" typedef information (PR 62170)

2017-07-14 Thread Martin Sebor
On 06/21/2017 01:59 AM, Volker Reichelt wrote: On 20 Jun, Jason Merrill wrote: On Tue, Jun 20, 2017 at 3:06 PM, David Malcolm wrote: It's not clear to me what the issue alluded to with negative obstack_blank is, but I chose to follow the above docs and use

Re: C PATCH to display types when printing a conversion warning (PR c/81233)

2017-07-14 Thread Martin Sebor
On 07/14/2017 09:40 AM, Martin Sebor wrote: On 07/14/2017 07:47 AM, Marek Polacek wrote: On Fri, Jul 14, 2017 at 02:52:36PM +0200, Marek Polacek wrote: On Thu, Jul 13, 2017 at 11:42:15AM -0600, Martin Sebor wrote: On 07/13/2017 08:18 AM, Marek Polacek wrote: This patch improves diagnostic

Re: C PATCH to display types when printing a conversion warning (PR c/81233)

2017-07-14 Thread Martin Sebor
On 07/14/2017 07:47 AM, Marek Polacek wrote: On Fri, Jul 14, 2017 at 02:52:36PM +0200, Marek Polacek wrote: On Thu, Jul 13, 2017 at 11:42:15AM -0600, Martin Sebor wrote: On 07/13/2017 08:18 AM, Marek Polacek wrote: This patch improves diagnostic in the C FE by printing the types when

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

2017-07-17 Thread Martin Sebor
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00411.html On 07/08/2017 02:45 PM, Martin Sebor wrote: PR 81117 asks for improved detection of common misuses(*) of strncpy and strncat. The attached patch is my solution. It consists of three related sets of changes: 1) Adds a new

[PING #2] [PATCH] enhance -Wrestrict for sprintf %s arguments

2017-07-17 Thread Martin Sebor
Ping #2: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00036.html On 07/02/2017 02:00 PM, Martin Sebor wrote: 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

Re: [PATCH] Implement one optimization from build_range_check in match.pd (PR tree-optimization/81346)

2017-07-18 Thread Martin Sebor
--- gcc/match.pd.jj 2017-07-17 16:25:20.0 +0200 +++ gcc/match.pd2017-07-18 12:32:52.896924558 +0200 @@ -1125,6 +1125,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && wi::neg_p (@1, TYPE_SIGN (TREE_TYPE (@1 (cmp @2 @0)) +/* (X - 1U) <= INT_MAX-1U into (int) X

Re: [PATCH] Implement one optimization from build_range_check in match.pd (PR tree-optimization/81346)

2017-07-18 Thread Martin Sebor
On 07/18/2017 09:43 AM, Jakub Jelinek wrote: On Tue, Jul 18, 2017 at 09:31:11AM -0600, Martin Sebor wrote: --- gcc/match.pd.jj 2017-07-17 16:25:20.0 +0200 +++ gcc/match.pd2017-07-18 12:32:52.896924558 +0200 @@ -1125,6 +1125,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT

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

2017-07-16 Thread Martin Sebor
Being implemented in the front end, the -Wrestrict warning detects only trivial instances of violations. The attached patch extends the implementation to the middle-end where data flow and alias analysis can be combined to detect even complex cases of overlap. This work is independent of but

Re: [PATCH] enhance -Wrestrict for sprintf %s arguments

2017-07-19 Thread Martin Sebor
On 07/19/2017 12:42 AM, Jeff Law wrote: On 07/02/2017 02:00 PM, Martin Sebor wrote: 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

Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers'

2017-07-21 Thread Martin Sebor
On 07/20/2017 10:35 AM, Volker Reichelt wrote: Hi, the following patch introduces a new C++ warning option -Wduplicated-access-specifiers that warns about redundant access-specifiers in classes, e.g. class B { public: B(); private: void foo(); private: int i;

Re: c-family PATCH to improve -Wsign-compare (PR c/81417)

2017-07-25 Thread Martin Sebor
How hard would it be to also suppress the warning for benign comparisons like C++ manages to do? E.g., C warns on this code even though there's no problem with it: int foo (unsigned int b) { const int a = 1; return (a < b); } Martin On 07/25/2017 03:45 AM, Marek Polacek wrote:

Re: Add -Wsuggest-attribute=cold

2017-07-24 Thread Martin Sebor
+extern void do_something_interesting_and_never_return (); + +int +foo1(int a) +{ /* { dg-warning "cold" "detect cold candidate" { target *-*-* } "8" } */ + if (a) +abort (); + else +abort (); +} In this case it looks to me like with the patch GCC will actually issue two suggestions:

Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers'

2017-07-23 Thread Martin Sebor
On 07/23/2017 02:42 PM, Volker Reichelt wrote: On 21 Jul, Martin Sebor wrote: On 07/20/2017 10:35 AM, Volker Reichelt wrote: Hi, the following patch introduces a new C++ warning option -Wduplicated-access-specifiers that warns about redundant access-specifiers in classes, e.g. class B

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

2017-07-24 Thread Martin Sebor
On 07/17/2017 01:17 PM, Martin Sebor wrote: On 07/10/2017 05:27 PM, Joseph Myers wrote: On Mon, 10 Jul 2017, Martin Sebor wrote: On 07/07/2017 10:58 AM, Joseph Myers wrote: This patch is OK. Thanks. Committed in r250104. Do you have any comments on or concerns with changing how

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

2017-07-24 Thread Martin Sebor
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 (building GDB, Glibc

Re: [PATCH] enhance -Wrestrict for sprintf %s arguments

2017-07-24 Thread Martin Sebor
Ping: Jeff, please see my reply below. On 07/19/2017 10:10 AM, Martin Sebor wrote: On 07/19/2017 12:42 AM, Jeff Law wrote: On 07/02/2017 02:00 PM, Martin Sebor wrote: The attached patch enhances the -Wrestrict warning to detect more than just trivial instances of overlapping copying

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

2017-07-24 Thread Martin Sebor
Ping #2: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00411.html On 07/08/2017 02:45 PM, Martin Sebor wrote: PR 81117 asks for improved detection of common misuses(*) of strncpy and strncat. The attached patch is my solution. It consists of three related sets of changes: 1) Adds a new

Re: [PATCH] C++: fix ordering of missing std #include suggestion (PR c++/81514)

2017-07-27 Thread Martin Sebor
I'm not sure why Solaris' decl of std::sprintf doesn't hit the reject path above. I was able to reproduce the behavior seen on Solaris on my Fedora box by using this: namespace std { extern int sprintf (char *dst, const char *format, ...); } This is how C library symbols were

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

2017-07-27 Thread Martin Sebor
I think this is great. My overall question is: is the new BLT representation available in the middle-end? If not, do you have plans to make it available? (I think it might be especially useful there, to either accurately highlight the source of a problem when it's far removed from the problem

Re: [PATCH 04/17] C frontend: capture BLT information

2017-07-27 Thread Martin Sebor
On 07/24/2017 02:05 PM, David Malcolm wrote: This patch extends the C frontend so that it optionally builds a BLT tree, by using an auto_blt_node class within the recursive descent through the parser, so that its ctor/dtors build the blt_node hierarchy; this is rapidly (I hope) rejected in the

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

2017-06-28 Thread Martin Sebor
On 06/28/2017 11:41 AM, Joseph Myers wrote: On Wed, 28 Jun 2017, Martin Sebor wrote: I don't think there is an equivalent, dedicated trait in C++ to do that either. One would have to be composed of the lower-level ones. There also is no trait that would remove all type qualifiers (including

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

2017-06-29 Thread Martin Sebor
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/gcc/hash-table.h @@ -803,7 +803,10 @@ hash_table::empty_slow () m_size_prime_index = nindex; } else

Re: PR80806

2017-06-29 Thread Martin Sebor
On 06/29/2017 12:05 PM, Jeff Law wrote: On 06/29/2017 11:57 AM, Jeff Law wrote: On 05/23/2017 09:58 AM, Martin Sebor wrote: On 05/18/2017 12:55 PM, Prathamesh Kulkarni wrote: Hi, The attached patch tries to fix PR80806 by warning when a variable is set using memset (and friends) but not used

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