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

2017-02-23 Thread Martin Sebor
On 02/22/2017 05:43 PM, Jason Merrill wrote: On Wed, Feb 22, 2017 at 3:44 PM, Martin Sebor <mse...@gmail.com> wrote: On 02/22/2017 11:02 AM, Jason Merrill wrote: On Tue, Feb 21, 2017 at 4:27 PM, Martin Sebor <mse...@gmail.com> wrote: Ah, I see, your patch changes attribute unu

Re: [PATCH, doc]: Mention that -mfpmath=sse is the default on 32bit x86 w/ SSE2 and -ffast-math

2017-02-23 Thread Martin Sebor
On 02/23/2017 12:01 PM, Uros Bizjak wrote: On Thu, Feb 23, 2017 at 7:07 PM, Martin Sebor <mse...@gmail.com> wrote: A minor grammatical nit: +This is the default choice for most of x86-32 targets. "for most x86-32 targets" is correct unless the targets are some specific

enable -Wformat-truncation with -Og (PR 79691)

2017-02-23 Thread Martin Sebor
Bug 79691 - -Wformat-truncation suppressed by (and only by) -Og points out that the gimple-ssa-sprintf pass doesn't run when this optimization option is used. That's because I forgot to add it to the set of optimization passes that run with that option. The attached trivial patch tested on

Re: enable -Wformat-truncation with -Og (PR 79691)

2017-02-24 Thread Martin Sebor
On 02/24/2017 03:10 AM, Richard Biener wrote: On Fri, Feb 24, 2017 at 1:35 AM, Martin Sebor <mse...@gmail.com> wrote: Bug 79691 - -Wformat-truncation suppressed by (and only by) -Og points out that the gimple-ssa-sprintf pass doesn't run when this optimization option is used. That's bec

[PATCH] avoid using upper bound of width and precision in -Wformat-overlow (PR 79692)

2017-02-25 Thread Martin Sebor
In an arithmetic directive with the width or precision specified by an argument to the asterisk (e.g., "%*x") and where the argument range is unknown, for the purposes of the return value optimization the pass must assume it's potentially as large as INT_MAX. But for the purposes of issuing a

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

2017-02-22 Thread Martin Sebor
On 02/22/2017 11:02 AM, Jason Merrill wrote: On Tue, Feb 21, 2017 at 4:27 PM, Martin Sebor <mse...@gmail.com> wrote: Ah, I see, your patch changes attribute unused handling for local variables from tracking TREE_USED to lookup_attribute. I'm not opposed to this change, but I'

Re: [PATCH, doc]: Mention that -mfpmath=sse is the default on 32bit x86 w/ SSE2 and -ffast-math

2017-02-23 Thread Martin Sebor
On 02/23/2017 04:09 AM, Uros Bizjak wrote: Hello! This patch documents a little gcc secret... 2017-02-23 Uros Bizjak * doc/invoke.texi (x86 Options, -mfpmath=sse): Mention that -mfpmath=sse is the default also for x86-32 targets with SSE2 instruction set when

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

2017-02-21 Thread Martin Sebor
On 02/21/2017 11:08 AM, Jason Merrill wrote: On 02/17/2017 05:07 PM, Martin Sebor wrote: * decl.c (poplevel): Avoid diagnosing entities declared with attribute unused. This change is OK. (initialize_local_var): Do not consider the type of a variable when determining whether

[PATCH] avoid eliminating snprintf(d, n, ...) whose zero size comes from a range (PR 79496)

2017-02-13 Thread Martin Sebor
When the size of the destination in a call to snprintf is in a range, at level 1 -Wformat-truncation uses the upper bound as the size while the stricter level 2 uses the lower bound. However, when the lower bound is zero treating it the same as a constant zero and optimizing the call into a

Re: [PATCH] use zero as the lower bound for a signed-unsigned range (PR 79327)

2017-02-14 Thread Martin Sebor
On 02/14/2017 09:39 AM, Jakub Jelinek wrote: On Tue, Feb 14, 2017 at 09:36:44AM -0700, Martin Sebor wrote: @@ -1371,7 +1354,8 @@ format_integer (const directive , tr else { res.range.likely = res.range.min; - if (likely_adjust && maybebase && base != 10) +

Re: [PATCH doc] update -dM to mention excluded macros (PR 41540)

2017-02-13 Thread Martin Sebor
On 02/12/2017 01:27 AM, Gerald Pfeifer wrote: On Tue, 7 Feb 2017, Martin Sebor wrote: The attached documentation-only patch clarifies the description of the -dM option to mention that __FILE__ (and other predefined macros) do no appear on the list generated by the option. +The predefined

[PATCH] suppress unhelpful -Wformat-truncation=2 INT_MAX warning (PR 79448)

2017-02-10 Thread Martin Sebor
The recent Fedora mass rebuild revealed that the Wformat-truncation=2 checker is still a bit too aggressive and complains about potentially unbounded strings causing subsequent directives t exceed the INT_MAX limit. (It's unclear how the build ended up enabling level 2 of the warning.) This is

Re: [PATCH] avoid ICE when attempting to init a flexible array member (PR c++/79363)

2017-02-10 Thread Martin Sebor
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00489.html On 02/06/2017 07:04 PM, Martin Sebor wrote: The attached patch avoids another ICE (in addition to the already fixed bug 72775) in flexible array member NSDMI. To avoid code duplication and for consistency I factored

Re: [PATCH] use zero as the lower bound for a signed-unsigned range (PR 79327)

2017-02-14 Thread Martin Sebor
On 02/14/2017 12:18 AM, Jakub Jelinek wrote: On Mon, Feb 13, 2017 at 04:53:19PM -0700, Jeff Law wrote: dirtype is one of the standard {un,}signed {char,short,int,long,long long} types, all of them have 0 in their ranges. For VR_RANGE we almost always set res.knownrange to true: /* Set

Re: [PATCH] suppress unhelpful -Wformat-truncation=2 INT_MAX warning (PR 79448)

2017-02-14 Thread Martin Sebor
On 02/13/2017 04:33 PM, Jeff Law wrote: On 02/10/2017 10:55 AM, Martin Sebor wrote: The recent Fedora mass rebuild revealed that the Wformat-truncation=2 checker is still a bit too aggressive and complains about potentially unbounded strings causing subsequent directives t exceed the INT_MAX

Re: [PATCH] use zero as the lower bound for a signed-unsigned range (PR 79327)

2017-02-14 Thread Martin Sebor
On 02/14/2017 01:32 PM, Jakub Jelinek wrote: On Tue, Feb 14, 2017 at 12:15:59PM -0700, Martin Sebor wrote: That comment explains how the likely_adjust variable ("the adjustment") is being used, or more precisely, how it was being used in the first version of the patch. The comm

Re: [PATCH doc] clean up -fdump-tree- options (PR 32003)

2017-02-15 Thread Martin Sebor
On 02/15/2017 05:51 AM, Thomas Schwinge wrote: Hi! On Wed, 1 Feb 2017 20:26:24 -0700, Martin Sebor <mse...@gmail.com> wrote: On 02/01/2017 08:06 PM, Sandra Loosemore wrote: On 02/01/2017 06:57 PM, Martin Sebor wrote: PR middle-end/32003 * doc/invoke.texi (-fdump-rtl-):

Re: [PATCH] avoid calling memset et al. with excessively large sizes (PR 79095)

2017-01-17 Thread Martin Sebor
On 01/17/2017 08:26 AM, Jeff Law wrote: On 01/16/2017 05:06 PM, Martin Sebor wrote: The test case submitted in bug 79095 - [7 regression] spurious stringop-overflow warning shows that GCC optimizes some loops into calls to memset with size arguments in excess of the object size limit. Since

Re: [PATCH] adding missing LTO to some warning options (PR 78606)

2017-01-17 Thread Martin Sebor
On 01/17/2017 05:04 AM, Kyrill Tkachov wrote: Hi Martin, On 10/01/17 22:16, Martin Sebor wrote: The -Walloca-larger-than, -Wformat-length, and -Wformat-truncation options do not mention LTO among the supported languages and so are disabled when -flto is used, causing false negatives

Re: [PATCH] avoid calling memset et al. with excessively large sizes (PR 79095)

2017-01-17 Thread Martin Sebor
On 01/17/2017 12:38 AM, Jakub Jelinek wrote: On Mon, Jan 16, 2017 at 05:06:40PM -0700, Martin Sebor wrote: The test case submitted in bug 79095 - [7 regression] spurious stringop-overflow warning shows that GCC optimizes some loops into calls to memset with size arguments in excess

Re: [PATCH] avoid calling memset et al. with excessively large sizes (PR 79095)

2017-01-17 Thread Martin Sebor
On 01/17/2017 10:57 AM, Jeff Law wrote: On 01/17/2017 09:12 AM, Martin Sebor wrote: On 01/17/2017 08:26 AM, Jeff Law wrote: On 01/16/2017 05:06 PM, Martin Sebor wrote: The test case submitted in bug 79095 - [7 regression] spurious stringop-overflow warning shows that GCC optimizes some loops

Re: [PATCH] avoid calling memset et al. with excessively large sizes (PR 79095)

2017-01-18 Thread Martin Sebor
On 01/18/2017 01:10 AM, Jakub Jelinek wrote: On Tue, Jan 17, 2017 at 10:59:43PM -0700, Jeff Law wrote: I agree that breaking those applications would be bad. It could be dealt with by adding an option to let them disable the insertion of the trap. With the warning, programmers would get a

Re: [PR middle-end/79123] cast false positive in -Walloca-larger-than=

2017-01-20 Thread Martin Sebor
On 01/20/2017 01:17 AM, Richard Biener wrote: On Thu, Jan 19, 2017 at 5:53 PM, Martin Sebor <mse...@gmail.com> wrote: On 01/19/2017 05:45 AM, Richard Biener wrote: On Thu, Jan 19, 2017 at 1:17 PM, Aldy Hernandez <al...@redhat.com> wrote: In the attached testcase, we have a cle

[PATCH] avoid calling memset et al. with excessively large sizes (PR 79095)

2017-01-16 Thread Martin Sebor
The test case submitted in bug 79095 - [7 regression] spurious stringop-overflow warning shows that GCC optimizes some loops into calls to memset with size arguments in excess of the object size limit. Since such calls will unavoidably lead to a buffer overflow and memory corruption the attached

Re: [PATCH] fix integer overflow bugs in gimple-ssa-sprintf.c (PR 78608)

2017-01-16 Thread Martin Sebor
If the FIXME was a future thing, then this is OK with the nits fixed. If the FIXME was a marker for something you intended to address now and just forgot, then we either need another iteration or a follow-up patch depending on the severity of the FIXME in your mind. As we discussed privately,

Re: [PR middle-end/79123] cast false positive in -Walloca-larger-than=

2017-01-19 Thread Martin Sebor
On 01/19/2017 05:45 AM, Richard Biener wrote: On Thu, Jan 19, 2017 at 1:17 PM, Aldy Hernandez wrote: In the attached testcase, we have a clearly bounded case of alloca which is being incorrectly reported: void g (int *p, int *q) { size_t n = (size_t)(p - q); if (n <

Re: [PATCH] tree-optimization/71831 - __builtin_object_size poor results with no optimization

2016-08-21 Thread Martin Sebor
On 08/20/2016 01:26 AM, Jakub Jelinek wrote: On Fri, Aug 19, 2016 at 04:30:47PM -0600, Martin Sebor wrote: The patch looks bigger than it actually is because: 1) It modifies the return type of the function to bool rather than unsigned HOST_WIDE_INT representing the object size

Re: [PATCH] tree-optimization/71831 - __builtin_object_size poor results with no optimization

2016-08-21 Thread Martin Sebor
On 08/20/2016 01:02 AM, Florian Weimer wrote: * Martin Sebor: As requested in the review of the following patch https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01363.html attached is the small enhancement to compute_builtin_object_size to make the function usable even without optimization

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-08-19 Thread Martin Sebor
the next patch. Martin gcc/c-family/ChangeLog: 2016-08-18 Martin Sebor <mse...@redhat.com> * c-ada-spec.c (dump_ada_function_declaration): Increase buffer size to guarantee it fits the output of the formatted function regardless of its arguments. gcc/cp/ChangeLog: 2016-08-18 Martin

[PATCH] tree-optimization/71831 - __builtin_object_size poor results with no optimization

2016-08-19 Thread Martin Sebor
actually changing any of the code there). Martin PR tree-optimization/71831 - __builtin_object_size poor results with no optimization gcc/testsuite/ChangeLog: 2016-08-19 Martin Sebor <mse...@redhat.com> PR tree-optimization/71831 * gcc.dg/builtin-object-size-16.c: New test. gcc/Cha

Re: Implement -Wimplicit-fallthrough (version 4)

2016-08-22 Thread Martin Sebor
Just a few minor nits based on a quick reading of the patch: @@ -24114,6 +24164,16 @@ cp_parser_std_attribute (cp_parser *parser) " use %"); TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu"); } + /* C++17 fallthrough

Re: PR79697: Delete calls to strdup, strndup, realloc if there is no lhs

2017-02-25 Thread Martin Sebor
On 02/25/2017 11:54 AM, Prathamesh Kulkarni wrote: On 25 February 2017 at 14:43, Marc Glisse wrote: On Sat, 25 Feb 2017, Prathamesh Kulkarni wrote: Hi, The attached patch deletes calls to strdup, strndup if it's return-value is unused, and same for realloc if the first

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

2017-02-28 Thread Martin Sebor
On 02/28/2017 11:00 AM, Jeff Law wrote: On 02/28/2017 10:54 AM, Martin Sebor wrote: The GCC 7 release criteria page mentions Java even though the front end has been removed. The attached patch removes Java from the criteria page. While reviewing the rest of the text I noticed a few minor

[PATCH docs] remove Java from GCC 7 release criteria

2017-02-28 Thread Martin Sebor
The GCC 7 release criteria page mentions Java even though the front end has been removed. The attached patch removes Java from the criteria page. While reviewing the rest of the text I noticed a few minor typos that I corrected in the patch as well. Btw., as an aside, I read the page to see if

Re: [PATCH] avoid using upper bound of width and precision in -Wformat-overlow (PR 79692)

2017-03-01 Thread Martin Sebor
So in some cases you use + /* For an indeterminate precision the lower bound must be assumed + to be zero. */ + if (prec[0] < 0 && prec[1] >= 0) Note prec[1] >= 0 In other cases you have: +/* The minimum output with unknown precision is a single byte + (e.g., "0") but the

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

2017-03-01 Thread Martin Sebor
The uses of MPFR in gimple-ssa-sprintf.c apparently cause the library to allocates some internal caches that it then leaks on program exit, causing Valgrind memory leak errors. The MPFR manual "strongly advises to [call mpfr_free_cache] before terminating a thread, or before exiting when using

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

2017-03-01 Thread Martin Sebor
On 03/01/2017 08:08 AM, Gerald Pfeifer wrote: On Tue, 28 Feb 2017, Martin Sebor wrote: The GCC 7 release criteria page mentions Java even though the front end has been removed. The attached patch removes Java from the criteria page. While reviewing the rest of the text I noticed a few minor

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

2017-03-01 Thread Martin Sebor
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 PM GMT+01:00, Jeff Law <l...@redhat.com> wrote: On 02/28/2017 10:54 AM, Martin

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-02-27 Thread Martin Sebor
On 02/26/2017 07:21 AM, Gerald Pfeifer wrote: On Sun, 19 Feb 2017, Gerald Pfeifer wrote: That was quite a bit; thanks for doing that, Jakub! In the patch below I try to streamline language a bit, document options being implied by -Os (in addition to -O2 or higher), fix grammar in a few places,

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

2017-02-28 Thread Martin Sebor
On 02/28/2017 01:41 PM, Richard Biener wrote: On February 28, 2017 7:00:39 PM GMT+01:00, Jeff Law <l...@redhat.com> wrote: On 02/28/2017 10:54 AM, Martin Sebor wrote: The GCC 7 release criteria page mentions Java even though the front end has been removed. The attached patch removes Jav

Re: [PATCH] RFC: On-demand locations within string-literals

2016-08-23 Thread Martin Sebor
On 08/23/2016 07:59 AM, David Malcolm wrote: On Mon, 2016-08-22 at 21:25 -0600, Martin Sebor wrote: Beyond that, the range normally works fine, except when macros are involved like they are in my tests. You can see the effect in the range.out file. (This works without your patch but it could

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-08-24 Thread Martin Sebor
On 08/24/2016 04:03 PM, Joseph Myers wrote: On Wed, 24 Aug 2016, Martin Sebor wrote: No. I recall having seen Glibc fail with ENOMEM years ago when formatting a floating point number to a very large precision but I haven't seen any implementation fail. I haven't yet looked to see

Re: [PATCH] Move class substring_loc from c-family into gcc

2016-09-02 Thread Martin Sebor
I've successfully tested the patch below by incorporating it into the -Wformat-length pass I've been working on. I'd like to submit the latest and hopefully close to final version of my work for review without duplicating this code and it might be helpful if it was possible to build my latest

Re: [PATCH] Move class substring_loc from c-family into gcc

2016-09-06 Thread Martin Sebor
On 09/03/2016 03:13 AM, Manuel López-Ibáñez wrote: On 02/09/16 23:55, Martin Sebor wrote: diff --git a/gcc/substring-locations.h b/gcc/substring-locations.h index f839c74..bb0de4f 100644 --- a/gcc/substring-locations.h +++ b/gcc/substring-locations.h @@ -20,6 +20,73 @@ along with GCC; see

Re: PR35503 - warn for restrict pointer

2016-09-01 Thread Martin Sebor
The attached version passes bootstrap+test on ppc64le-linux-gnu. Given that it only looks if parameters are restrict qualified and not how they're used inside the callee, this can have false positives as in above test-cases. Should the warning be put in Wextra rather than Wall (I have left it in

Re: [PATCH] Fixups for Martin's gimple-ssa-sprintf.c patch

2016-08-31 Thread Martin Sebor
On 08/25/2016 10:30 AM, Martin Sebor wrote: On 08/25/2016 10:23 AM, David Malcolm wrote: Martin: here are the fixups for your patch I needed to apply to make it work with mine. I couldn't actually get any of your existing test cases to emit locations within the string literals, due to them all

Re: Fix bogus warning with -Wlogical-not-parentheses (PR c/77292)

2016-08-31 Thread Martin Sebor
On 08/26/2016 07:44 AM, Marek Polacek wrote: On Thu, Aug 25, 2016 at 11:35:53AM -0600, Martin Sebor wrote: +foo (int a, int b) +{ + int r = 0; + r += !a == (a < b); + r += !a == (a > b); + r += !a == (a >= b); + r += !a == (a <= b); + r += !a == (a != b); + r += !a == (a

Re: [PATCH] Fixups for Martin's gimple-ssa-sprintf.c patch

2016-08-31 Thread Martin Sebor
On 08/31/2016 10:26 AM, David Malcolm wrote: On Wed, 2016-08-31 at 10:23 -0600, Martin Sebor wrote: On 08/25/2016 10:30 AM, Martin Sebor wrote: On 08/25/2016 10:23 AM, David Malcolm wrote: Martin: here are the fixups for your patch I needed to apply to make it work with mine. I couldn't

Re: C++ PATCH to forbid use of bool with the ++ operator

2016-09-13 Thread Martin Sebor
- /* Forbid using -- on `bool'. */ + /* Forbid using -- or ++ in C++17 on `bool'. */ if (TREE_CODE (declared_type) == BOOLEAN_TYPE) { if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR) @@ -6040,6 +6040,20 @@ cp_build_unary_op (enum tree_code

Re: [PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

2016-09-14 Thread Martin Sebor
Attached is an updated patch that does away with the "overlapping" warning and instead issues the same warnings as the C front end (though with more context). In struct flexmems_t I've retained the NEXT array even though only the first element is used to diagnose problems. The second element is

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-08 Thread Martin Sebor
On 09/08/2016 01:45 PM, David Malcolm wrote: On Thu, 2016-09-08 at 13:03 -0600, Martin Sebor wrote: Attached is another update to the patch to address the last round of comments and suggestions, most notably to: * implement the checking of the implementation limit of 4,095

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-08 Thread Martin Sebor
On 09/08/2016 01:21 PM, Jeff Law wrote: On 08/24/2016 10:40 AM, Martin Sebor wrote: On 08/23/2016 05:00 PM, Joseph Myers wrote: Some observations: * Does -fprintf-return-value allow for the possibility of snprintf failing because of a memory allocation failure and so returning -1 when GCC

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-12 Thread Martin Sebor
On 09/12/2016 04:08 PM, Joseph Myers wrote: On Sun, 11 Sep 2016, Martin Sebor wrote: Attached is revision 8 of the patch (hopefully) adjusted as requested above, and with a simple test with of the multiline The ChangeLog appears not to have been updated (at least, it doesn't mention

[PATCH] have __builtin_object_size handle POINTER_PLUS with non-const offset

2016-09-15 Thread Martin Sebor
__builtin_object_size fails for POINTER_PLUS expressions involving non-constant offsets into objects of known size, causing GCC to fail to detect (and add instrumentation to prevent) buffer overflow in some basic cases such as the following: void f (unsigned i) { char d [3]; memcpy

Re: [PATCH] avoid non-printable characters in diagnostics (c/77620, c/77521)

2016-09-09 Thread Martin Sebor
On 09/09/2016 07:59 AM, Joseph Myers wrote: On Thu, 8 Sep 2016, Martin Sebor wrote: PS I used hexadecimal based on what c-format.c does but now that I checked more carefully how %qE formats string literals I see it uses octal. I think hexadecimal is preferable because it avoids ambiguity

[PATCH] avoid non-printable characters in diagnostics (c/77620, c/77521)

2016-09-08 Thread Martin Sebor
directive should quote non-printable characters gcc/c-family/ChangeLog: 2016-09-08 Martin Sebor <mse...@redhat.com> PR c/77520 PR c/77521 * c-format.c (argument_parser::find_format_char_info): Use %qc format directive unconditionally. gcc/ChangeLog: 2016-09-08 Martin Sebor <mse.

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-09 Thread Martin Sebor
Patch #1. All the fixes to static buffer sizes that were inspired by your warning. These are all approved and can go in immediately. Attached is this patch. Hi, this patch changed the file gcc/go/gofrontend/expressions.cc. As described in gcc/go/gofrontend/README, the files in the

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-05 Thread Martin Sebor
The problem is e.g. code calling getwchar and not checking for WEOF. 0xu does not fit in a 32-bit signed variable unless your code is confusing signed and unsigned freely. And even if you consider it OK to check after conversion to wchar_t rather than before, the lack of a wint_t

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-05 Thread Martin Sebor
On 10/05/2016 05:11 PM, Joseph Myers wrote: On Wed, 5 Oct 2016, Martin Sebor wrote: may have been subjected to. Issuing a warning for a safe piece of code only on the basis that there might be some other piece of code in the program that does something wrong makes no sense. Suggesting

Re: [PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

2016-10-05 Thread Martin Sebor
On 09/23/2016 12:00 PM, Jason Merrill wrote: On Thu, Sep 22, 2016 at 7:39 PM, Martin Sebor <mse...@gmail.com> wrote: On 09/21/2016 02:43 PM, Jason Merrill wrote: On Tue, Sep 20, 2016 at 1:01 PM, Martin Sebor <mse...@gmail.com> wrote: On 09/16/2016 12:19 PM, Jason Merrill wrote: O

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-05 Thread Martin Sebor
On 10/05/2016 10:27 AM, Joseph Myers wrote: On Wed, 5 Oct 2016, Martin Sebor wrote: The warning would only helpful if there was a target where wchar_t didn't promote to a type with the same precision as wint_t, or in Or it could show up a logical error where the code should have had a wint_t

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-05 Thread Martin Sebor
On 10/05/2016 09:40 AM, Joseph Myers wrote: On Tue, 4 Oct 2016, Martin Sebor wrote: Well, typically cases where one of long and int is passed and the other is expected, but they have the same size, are bugs waiting to happen when the code is built on a 64-bit system. That is, they *should

Re: [PATCH] add uClibc target hook (PR bootstrap/77819)

2016-10-04 Thread Martin Sebor
On 10/04/2016 08:54 AM, Bernd Schmidt wrote: On 10/04/2016 04:34 PM, Martin Sebor wrote: I copied the conditional from config/linux.h but I admit I don't fully understand when the macro is defined. AFAICT it's done in config.gcc, for a limited set of targets. Should I still remove it from

[PATCH] backport dejagnu relative numbers to 6-branch?

2016-10-04 Thread Martin Sebor
While backporting a patch for 77804 to the gcc-6-branch I noticed that the DejaGnu relative number patch below is not available there (the new test failed). Is it worth backporting it to it? https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01617.html Martin

Re: [PATCH] backport dejagnu relative numbers to 6-branch?

2016-10-04 Thread Martin Sebor
On 10/04/2016 12:35 PM, Jakub Jelinek wrote: On Tue, Oct 04, 2016 at 12:05:50PM -0600, Martin Sebor wrote: While backporting a patch for 77804 to the gcc-6-branch I noticed that the DejaGnu relative number patch below is not available there (the new test failed). Is it worth backporting

Re: [PATCH] add uClibc target hook (PR bootstrap/77819)

2016-10-04 Thread Martin Sebor
On 10/04/2016 02:42 AM, Bernd Schmidt wrote: On 10/03/2016 12:02 AM, Martin Sebor wrote: I couldn't find a good uclibc-only file where to put the new definition of the hook so I conditionally added it to targethooks.c. diff --git a/gcc/targhooks.c b/gcc/targhooks.c index d75650f..77b4a18

Re: [PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

2016-10-06 Thread Martin Sebor
/* Issue diagnostics for invalid flexible and zero-length array members - found in base classes or among the members of the current class. */ + /* Issue diagnostics for invalid flexible and zero-length array + members found in base classes or among the members of the current + clas

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-06 Thread Martin Sebor
On 10/05/2016 05:54 PM, Joseph Myers wrote: On Wed, 5 Oct 2016, Martin Sebor wrote: On 10/05/2016 05:11 PM, Joseph Myers wrote: On Wed, 5 Oct 2016, Martin Sebor wrote: may have been subjected to. Issuing a warning for a safe piece of code only on the basis that there might be some other

Re: [PATCH] define TARGET_PRINTF_POINTER_FORMAT for powerpc-linux (77837)

2016-10-05 Thread Martin Sebor
On 10/03/2016 08:11 PM, Martin Sebor wrote: On 10/03/2016 07:10 PM, Segher Boessenkool wrote: On Mon, Oct 03, 2016 at 05:30:35PM -0600, Martin Sebor wrote: The attached patch adds definitions of TARGET_PRINTF_POINTER_FORMAT to the rs6000 pair of linux.h and linux64.h headers, analogous

Re: [PATCH] backport dejagnu relative numbers to 6-branch?

2016-10-04 Thread Martin Sebor
On 10/04/2016 01:01 PM, Mike Stump wrote: On Oct 4, 2016, at 11:05 AM, Martin Sebor <mse...@gmail.com> wrote: While backporting a patch for 77804 to the gcc-6-branch I noticed that the DejaGnu relative number patch below is not available there (the new test failed). Is it worth backp

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-04 Thread Martin Sebor
as it happens, I'd already started bootstraps with your patch before your mail arrived :-) Thanks for your help getting to the bottom of this! We're left with FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-1.c (test for excess errors) FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-4.c (test for

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-10-04 Thread Martin Sebor
On 10/04/2016 06:21 PM, Joseph Myers wrote: On Tue, 4 Oct 2016, Martin Sebor wrote: I've built the sparc-sun-solaris2.12 toolchain and reproduced these warnings. They are vestiges of those I saw and some of which I fixed before. The problem is that %lc expects a wint_t argument which

Re: [PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

2016-09-20 Thread Martin Sebor
On 09/16/2016 12:19 PM, Jason Merrill wrote: On 09/14/2016 01:03 PM, Martin Sebor wrote: Attached is an updated patch that does away with the "overlapping" warning and instead issues the same warnings as the C front end (though with more context). In struct flexmems_t I've retaine

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-21 Thread Martin Sebor
On 09/21/2016 01:11 AM, Markus Trippelsdorf wrote: On 2016.09.11 at 20:03 -0600, Martin Sebor wrote: On 09/08/2016 04:10 PM, Joseph Myers wrote: On Thu, 8 Sep 2016, Martin Sebor wrote: PR middle-end/49905 - Better sanity checking on sprintf src & dest to produce warning for d

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-21 Thread Martin Sebor
On 09/21/2016 04:36 AM, Christophe Lyon wrote: Hi Martin, On 21 September 2016 at 09:11, Markus Trippelsdorf <mar...@trippelsdorf.de> wrote: On 2016.09.11 at 20:03 -0600, Martin Sebor wrote: On 09/08/2016 04:10 PM, Joseph Myers wrote: On Thu, 8 Sep 2016, Martin Sebor wrote: PR midd

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-21 Thread Martin Sebor
On 09/21/2016 08:37 AM, Alexander Monakov wrote: On Wed, 21 Sep 2016, Martin Sebor wrote: On 09/21/2016 01:11 AM, Markus Trippelsdorf wrote: The patch uses "nul" instead of "null" throughout. Yes, that's intentional. NUL and null are alternate spellings for the sa

Re: Add FALLTHRU to gimple-ssa-sprintf.c

2016-09-21 Thread Martin Sebor
On 09/21/2016 05:07 AM, Marek Polacek wrote: On Wed, Sep 21, 2016 at 12:57:23PM +0200, Jakub Jelinek wrote: On Wed, Sep 21, 2016 at 12:52:33PM +0200, Marek Polacek wrote: Pointed out by Tobias. This looks like a missing fallthru marker. Ok? 2016-09-21 Marek Polacek

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-21 Thread Martin Sebor
On 09/21/2016 01:40 PM, Gerald Pfeifer wrote: I noticed the following bootstrap failure on i?86-unknown-freebsd that started in the last 24 hours: /scratch/tmp/gerald/gcc-HEAD/gcc/vec.c: In member function ‘void vec_usage::dump(mem_location*, mem_usage&) const’:

[PATCH] fix ICE on %lf directive in format_floating in gimple-ssa-sprintf.c (middle-end/77683)

2016-09-21 Thread Martin Sebor
). Martin PR middle-end/77683 - ICE on %lf directive in format_floating in gimple-ssa-sprintf.c:1163 gcc/testsuite/ChangeLog: 2016-09-21 Martin Sebor <mse...@redhat.com> PR middle-end/77683 * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases. gcc/ChangeLog: 2016-09-21 Martin

Re: [PATCH] have __builtin_object_size handle POINTER_PLUS with non-const offset

2016-09-16 Thread Martin Sebor
On 09/16/2016 04:29 AM, Richard Biener wrote: On Fri, Sep 16, 2016 at 5:29 AM, Martin Sebor <mse...@gmail.com> wrote: __builtin_object_size fails for POINTER_PLUS expressions involving non-constant offsets into objects of known size, causing GCC to fail to detect (and add instrumen

Re: PR35503 - warn for restrict pointer

2016-09-19 Thread Martin Sebor
and used pp_format for formatting arg_positions by adding specifier %I (name chosen arbitrarily). Does that look OK ? diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index a39815e..e8bd1ef 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -610,6 +610,23 @@ pp_format

Re: [PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

2016-09-22 Thread Martin Sebor
On 09/21/2016 02:43 PM, Jason Merrill wrote: On Tue, Sep 20, 2016 at 1:01 PM, Martin Sebor <mse...@gmail.com> wrote: On 09/16/2016 12:19 PM, Jason Merrill wrote: On 09/14/2016 01:03 PM, Martin Sebor wrote: + /* Type of the member. */ + tree fldtype = TREE_CODE (fld) == FIEL

Re: [PATCH, GCC] Deal with singular sentences in builtin-sprintf-warn-1.c regex

2016-09-23 Thread Martin Sebor
On 09/23/2016 09:42 AM, Thomas Preudhomme wrote: Sorry, forgot the patch. Please find it attached. Best regards, Thomas On 23/09/16 16:40, Thomas Preudhomme wrote: Hi, New builtin-sprintf-warn-1.c testcase contains a few regex of the form "\[0-9\]+ bytes" or ". bytes". This does not account

Re: [PATCH] Fix various minor gimple-ssa-sprintf.c issues

2016-09-23 Thread Martin Sebor
On 09/22/2016 01:46 AM, Marek Polacek wrote: On Thu, Sep 22, 2016 at 09:24:11AM +0200, Jakub Jelinek wrote: On Wed, Sep 21, 2016 at 06:38:54PM -0600, Martin Sebor wrote: On 09/21/2016 09:09 AM, Jakub Jelinek wrote: When looking at PR77676, I've noticed various small formatting etc. issues

Re: [PATCH] fix ILP32 bootstrap failures due to -Wformat-length

2016-09-21 Thread Martin Sebor
On 09/21/2016 05:09 PM, Jakub Jelinek wrote: On Wed, Sep 21, 2016 at 04:39:42PM -0600, Martin Sebor wrote: diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index dddb026..652d3fb 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -210,8 +210,8 @@ struct

Re: [PATCH] Fix various minor gimple-ssa-sprintf.c issues

2016-09-21 Thread Martin Sebor
On 09/21/2016 09:09 AM, Jakub Jelinek wrote: Hi! When looking at PR77676, I've noticed various small formatting etc. issues, like not using is_gimple_* APIs where we have them, not using gimple_call_builtin_p/gimple_call_fndecl (this one actually can show up, if e.g. uses the builtin with

[PATCH] fix ILP32 bootstrap failures due to -Wformat-length

2016-09-21 Thread Martin Sebor
/ml/gcc-patches/2016-09/msg01436.html Thanks Martin PR target/77676 - powerpc64 and powerpc64le stage2 bootstrap fail gcc/testsuite/ChangeLog: 2016-09-21 Martin Sebor <mse...@redhat.com> PR target/77676 * gcc.dg/tree-ssa/builtin-sprintf-2.c: Fix typo. * gcc.dg/tree-ssa/builtin-sprin

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-22 Thread Martin Sebor
your patch broke bootstrap with MPFR 2.4.2, which is still the recommended (or perhaps minimal) version according to install.texi: /vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c: In function 'int {anonymous}::format_floating_max(tree, char)':

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-22 Thread Martin Sebor
On 09/22/2016 06:14 AM, Rainer Orth wrote: Hi Martin, your patch broke bootstrap with MPFR 2.4.2, which is still the recommended (or perhaps minimal) version according to install.texi: [...] The following patch (together with your other one to fix ILP32 targets) allows a

Re: [PATCH] fix ILP32 bootstrap failures due to -Wformat-length

2016-09-22 Thread Martin Sebor
, Martin Sebor wrote: On 09/21/2016 05:09 PM, Jakub Jelinek wrote: On Wed, Sep 21, 2016 at 04:39:42PM -0600, Martin Sebor wrote: diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index dddb026..652d3fb 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -210,8 +210,8

Re: [PATCH] Fix various minor gimple-ssa-sprintf.c issues

2016-09-22 Thread Martin Sebor
What I would be even more grateful for is a review of the error prone parts like those that caused the bootstrap failure. I.e., any lingering assumptions about integer sizes between the host I must say I'm surprised you do all your computations in HOST_WIDE_INT, rather than say in wide_int,

Re: [PATCHv3][ARM] -mpure-code option for ARM

2016-09-22 Thread Martin Sebor
FYI (to help avoid raising duplicate bugs), I opened bug 77695 for the bootstrap failure. Martin On 09/22/2016 01:33 PM, Bill Seurer wrote: This patch breaks compilation on power: g++ -fno-PIE -c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-20 Thread Martin Sebor
David, in the way of feedback, I spent hours debugging the simple multiline test I added. It seems that DejaGnu is exquisitely sensitive to whitespaces in the multiline output. I appreciate that spacing is essential to lining up the caret and the tildes with the text of the program but tests

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-20 Thread Martin Sebor
+ /* The minimum and maximum length. The MAXLEN pointer stays unchanged + but MINLEN may be cleared during the execution of the function. */ + tree *minlen = length; + tree* const maxlen = length + 1; Check formatting here. I'm not sure if the formatting standards explicitly state how

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-20 Thread Martin Sebor
On 09/20/2016 01:38 PM, David Malcolm wrote: On Tue, 2016-09-20 at 13:35 -0600, Martin Sebor wrote: [...] +#if 0 ... +#else ... +#endif Please remove the #if 0'd code. Sorry about that. This was left over from my effort to persuade the substring_loc class to underline just the last

Re: PR35503 - warn for restrict pointer

2016-09-20 Thread Martin Sebor
On 09/20/2016 07:00 AM, Joseph Myers wrote: On Tue, 20 Sep 2016, Martin Sebor wrote: That said, since this specifier formats a vec, it seems that it might be useful to be able to format vectors of other elements, such as short and long. With that in mind, would adding a new V length modifier

Re: [RFC] Update gmp/mpfr/mpc minimum versions

2016-09-22 Thread Martin Sebor
On 04/27/2016 09:47 AM, Bernd Edlinger wrote: Am 27.04.2016 um 17:37 schrieb Rainer Orth: Bernd Edlinger writes: On 26.04.2016 22:14, Joseph Myers wrote: On Tue, 26 Apr 2016, Bernd Edlinger wrote: Hi, as we all know, it's high time now to adjust the minimum

Re: [PATCH] Fixups for Martin's gimple-ssa-sprintf.c patch

2016-08-25 Thread Martin Sebor
On 08/25/2016 10:23 AM, David Malcolm wrote: Martin: here are the fixups for your patch I needed to apply to make it work with mine. I couldn't actually get any of your existing test cases to emit locations within the string literals, due to them all being embedded in macro expansions (possibly

Re: Fix bogus warning with -Wlogical-not-parentheses (PR c/77292)

2016-08-25 Thread Martin Sebor
+foo (int a, int b) +{ + int r = 0; + r += !a == (a < b); + r += !a == (a > b); + r += !a == (a >= b); + r += !a == (a <= b); + r += !a == (a != b); + r += !a == (a == b); + r += !a == (a || b); + r += !a == (a && b); + r += !a == (!b); + + r += !a == (a ^ b); /* { dg-warning "logical

Re: [PATCH] Fix suggestions for non-trivial Wformat type cases (PR c/72858)

2016-08-22 Thread Martin Sebor
On 08/12/2016 01:27 PM, David Malcolm wrote: In r239260 I attempted to add fix-it hints for -Wformat type warnings. Unfortunately, my implementation was too simplistic, and only worked correctly for the most simple format strings: the fix-it hint would suggest replacement of an entire

<    3   4   5   6   7   8   9   10   11   12   >