[PING][PATCH] make handling of zero-length arrays in C++ pretty printer more robust (PR 97201)

2020-10-05 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554893.html On 9/25/20 12:58 PM, Martin Sebor wrote: The C and C++ representations of zero-length arrays are different: C uses a null upper bound of the type's domain while C++ uses SIZE_MAX.  This makes the middle end logic

Re: [r11-3641 Regression] FAIL: gcc.dg/torture/pta-ptrarith-1.c -Os scan-tree-dump alias "ESCAPED = {[^\n}]* i f [^\n}]*}" on Linux/x86_64 (-m32 -march=cascadelake)

2020-10-04 Thread Martin Sebor via Gcc-patches
On 10/4/20 10:51 AM, H.J. Lu via Gcc-patches wrote: On Sat, Oct 3, 2020 at 5:57 PM Segher Boessenkool wrote: On Sat, Oct 03, 2020 at 12:21:04PM -0700, sunil.k.pandey via Gcc-patches wrote: On Linux/x86_64, c34db4b6f8a5d80367c709309f9b00cb32630054 is the first bad commit commit c34db4b6f8a5d8

Re: [PATCH] generalized range_query class for multiple contexts

2020-10-01 Thread Martin Sebor via Gcc-patches
On 10/1/20 9:34 AM, Aldy Hernandez wrote: On 10/1/20 3:22 PM, Andrew MacLeod wrote: > On 10/1/20 5:05 AM, Aldy Hernandez via Gcc-patches wrote: >>> Thanks for doing all this!  There isn't anything I don't understand >>> in the sprintf changes so no questions from me (well, almost none). >>>

[PATCH] issue -Wstring-compare in more case (PR 95673)

2020-09-30 Thread Martin Sebor via Gcc-patches
-Wstring-compare triggers under the same strict conditions as the strcmp/strncmp call is folded into a constant: only when all the uses of the result are [in]equality expressions with zero. However, even when the call cannot be folded into a constant because the result is in addition used in othe

[PING #2][PATCH] use get_size_range to get allocated size (PR 92942)

2020-09-30 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552903.html (I lost track of this patch.) On 9/9/20 3:42 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552903.html On 8/28/20 11:12 AM, Martin Sebor wrote: The gimple_call_alloc_size() function

[committed] fix ICE in attribute access formatting (PR middle-end/97189)

2020-09-30 Thread Martin Sebor via Gcc-patches
Redeclaring a function that takes a VLA parameter with attribute access that references the same parameter can cause conflicts when the two aren't in sync. The conflicts are detected and diagnosed but also have to be resolved. The code wasn't robust enough to handle all cases gracefully, leading

Re: [PATCH] avoid modifying type in place (PR 97206)

2020-09-30 Thread Martin Sebor via Gcc-patches
On 9/30/20 3:57 AM, Jakub Jelinek wrote: On Tue, Sep 29, 2020 at 03:40:40PM -0600, Martin Sebor via Gcc-patches wrote: I will commit this patch later this week unless I hear concerns or suggestions for changes. That is not how the patch review process works. The review process hasn't

[pushed] correct/improve handling of null VLA arguments (PR 97188)

2020-09-29 Thread Martin Sebor via Gcc-patches
I have committed & pushed the fix in r11-3540. On 9/24/20 6:15 PM, Martin Sebor wrote: The machinery recently added to support -Warray-parameter and -Wvla-parameter also results in enhanced detection of null pointer arguments to VLA function parameters.  This enhancement wasn't

[PATCH] avoid modifying type in place (PR 97206)

2020-09-29 Thread Martin Sebor via Gcc-patches
To render the bounds as well as the static specifier in array and VLA function parameters the new -Warray-parameter and -Wvla-parameter warning builds a "synthetic" array type that corresponds to the form of the parameter, sets its qualifiers to match those of the pointer, and passes it to the pr

Re: [PATCH] c++: Implement -Wrange-loop-construct [PR94695]

2020-09-29 Thread Martin Sebor via Gcc-patches
On 9/28/20 11:34 AM, Marek Polacek wrote: On Fri, Sep 25, 2020 at 04:31:16PM -0600, Martin Sebor wrote: On 9/24/20 6:05 PM, Marek Polacek via Gcc-patches wrote: This new warning can be used to prevent expensive copies inside range-based for-loops, for instance: struct S { char arr[128

Re: [PING][PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-09-28 Thread Martin Sebor via Gcc-patches
On 9/25/20 11:17 PM, Jason Merrill wrote: On 9/22/20 4:05 PM, Martin Sebor wrote: The rebased and retested patches are attached. On 9/21/20 3:17 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553906.html (I'm working on rebasing the patch on t

Re: [PATCH] generalized range_query class for multiple contexts

2020-09-28 Thread Martin Sebor via Gcc-patches
On 9/25/20 11:41 AM, Andrew MacLeod wrote: On 9/23/20 7:53 PM, Martin Sebor via Gcc-patches wrote: On 9/18/20 12:38 PM, Aldy Hernandez via Gcc-patches wrote: As part of the ranger work, we have been trying to clean up and generalize interfaces whenever possible. This not only helps in

Re: [PATCH] c++: Implement -Wrange-loop-construct [PR94695]

2020-09-25 Thread Martin Sebor via Gcc-patches
On 9/24/20 6:05 PM, Marek Polacek via Gcc-patches wrote: This new warning can be used to prevent expensive copies inside range-based for-loops, for instance: struct S { char arr[128]; }; void fn () { S arr[5]; for (const auto x : arr) { } } where auto deduces to S and then w

[PATCH] make handling of zero-length arrays in C++ pretty printer more robust (PR 97201)

2020-09-25 Thread Martin Sebor via Gcc-patches
The C and C++ representations of zero-length arrays are different: C uses a null upper bound of the type's domain while C++ uses SIZE_MAX. This makes the middle end logic more complicated (and prone to mistakes) because it has to be prepared for both. A recent change to -Warray-bounds has the mi

[PATCH] correct/improve handling of null VLA arguments (PR 97188)

2020-09-24 Thread Martin Sebor via Gcc-patches
The machinery recently added to support -Warray-parameter and -Wvla-parameter also results in enhanced detection of null pointer arguments to VLA function parameters. This enhancement wasn't tested as comprehensively as it should have been and so has some bugs. The attached patch fixes one that

Re: [PATCH] generalized range_query class for multiple contexts

2020-09-24 Thread Martin Sebor via Gcc-patches
On 9/18/20 12:38 PM, Aldy Hernandez via Gcc-patches wrote: As part of the ranger work, we have been trying to clean up and generalize interfaces whenever possible.  This not only helps in reducing the maintenance burden going forward, but provides mechanisms for backwards compatibility between

Re: [PATCH] generalized range_query class for multiple contexts

2020-09-24 Thread Martin Sebor via Gcc-patches
On 9/24/20 12:46 AM, Aldy Hernandez wrote: On 9/24/20 1:53 AM, Martin Sebor wrote: Finally, unless both a type and function with the same name exist in the same scope there is no reason to mention the class-id when referencing a class name.  I.e., this    value_range_equiv

Re: [PATCH] generalized range_query class for multiple contexts

2020-09-23 Thread Martin Sebor via Gcc-patches
On 9/18/20 12:38 PM, Aldy Hernandez via Gcc-patches wrote: As part of the ranger work, we have been trying to clean up and generalize interfaces whenever possible.  This not only helps in reducing the maintenance burden going forward, but provides mechanisms for backwards compatibility between

[committed] check for a DECL or EXPRESSION before using its location (PR 97175)

2020-09-23 Thread Martin Sebor via Gcc-patches
Using DECL_SOURCE_LOCATION() with a tree node that's not a DECL isn't a good idea, and neither is using EXPR_LOCATION() with a node that is a DECL. Both trigger an ICE when presented with a node they don't expect. Until a TREE_LOCATION() that's safe to use with either is introduced, the attached

[committed] build a zero element array type that renders as T[0] in diagnostics

2020-09-23 Thread Martin Sebor via Gcc-patches
other configurations. I have committed the patch below following the C front-end approach of creating a zero-element array that does render as expected regardless of data models. Martin commit 67aeddb785ddcc8688ee5736ecab3c81de34a214 (HEAD -> master, origin/master, origin/HEAD) Author: Mart

[committed] also test for null in addition to error_mark_node (PR c/97131)

2020-09-23 Thread Martin Sebor via Gcc-patches
e ICE that it causes. Martin commit e92779db3304bc96a6b861f87c5edde8dd4d4030 Author: Martin Sebor Date: Wed Sep 23 15:02:01 2020 -0600 Avoid assuming input corresponds to valid source code (PR c/97131). gcc/c-family/ChangeLog: PR c/97131 * c-w

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-23 Thread Martin Sebor via Gcc-patches
On 9/23/20 9:44 AM, Szabolcs Nagy wrote: The 09/23/2020 09:22, Szabolcs Nagy wrote: The 09/21/2020 12:45, Martin Sebor via Gcc-patches wrote: On 9/21/20 12:20 PM, Vaseeharan Vinayagamoorthy wrote: After this patch, I am seeing this -Warray-parameter error: In file included from ../include

Re: [PING][PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-09-22 Thread Martin Sebor via Gcc-patches
The rebased and retested patches are attached. On 9/21/20 3:17 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553906.html (I'm working on rebasing the patch on top of the latest trunk which has changed some of the same code but it'd be helpfu

[PING][PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-09-21 Thread Martin Sebor via Gcc-patches
any substantive modifications.) Martin On 9/14/20 4:01 PM, Martin Sebor wrote: On 9/4/20 11:14 AM, Jason Merrill wrote: On 9/3/20 2:44 PM, Martin Sebor wrote: On 9/1/20 1:22 PM, Jason Merrill wrote: On 8/11/20 12:19 PM, Martin Sebor via Gcc-patches wrote: -Wplacement-new handles array indi

[committed] adjust ipa-sra tests to avoid using array parameters

2020-09-21 Thread Martin Sebor via Gcc-patches
post this patch once I'm done testing it. Martin commit 05193687dde2e5a6337164182a1946b584acfada Author: Martin Sebor Date: Mon Sep 21 14:33:29 2020 -0600 Avoid incidental failures due to implicit attribute access. gcc/testsuite/ChangeLog: PR c/50584

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-21 Thread Martin Sebor via Gcc-patches
20/09/2020, 01:02, "Gcc-patches on behalf of Martin Sebor via Gcc-patches" wrote: On 9/17/20 4:38 PM, Joseph Myers wrote: > On Wed, 16 Sep 2020, Martin Sebor via Gcc-patches wrote: > >> Attached is an updated revision of the patch. Besides the tweaks

Re: [PATCH] warn for integer overflow in allocation calls (PR 96838)

2020-09-21 Thread Martin Sebor via Gcc-patches
On 9/20/20 12:39 AM, Aldy Hernandez wrote: On 9/19/20 11:22 PM, Martin Sebor wrote: On 9/18/20 12:29 AM, Aldy Hernandez wrote: On 9/17/20 10:18 PM, Martin Sebor wrote: On 9/17/20 12:39 PM, Andrew MacLeod wrote: On 9/17/20 12:08 PM, Martin Sebor via Gcc-patches wrote: On 9/16/20 9:23 PM

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-19 Thread Martin Sebor via Gcc-patches
On 9/17/20 4:38 PM, Joseph Myers wrote: On Wed, 16 Sep 2020, Martin Sebor via Gcc-patches wrote: Attached is an updated revision of the patch. Besides the tweaks above it also contains a cosmetic change to the warning issued for mismatches in unspecified VLA bounds: it points at the decl with

Re: [PATCH] warn for integer overflow in allocation calls (PR 96838)

2020-09-19 Thread Martin Sebor via Gcc-patches
On 9/18/20 12:29 AM, Aldy Hernandez wrote: On 9/17/20 10:18 PM, Martin Sebor wrote: On 9/17/20 12:39 PM, Andrew MacLeod wrote: On 9/17/20 12:08 PM, Martin Sebor via Gcc-patches wrote: On 9/16/20 9:23 PM, Jeff Law wrote: On 9/15/20 1:47 PM, Martin Sebor wrote: Overflowing the size of a

Re: [PATCH] irange_pool class

2020-09-19 Thread Martin Sebor via Gcc-patches
On 9/18/20 3:09 PM, Andrew MacLeod wrote: On 9/18/20 4:35 PM, Martin Sebor wrote: On 9/18/20 11:36 AM, Andrew MacLeod wrote: On it works exactly like one would expect a simple allocator to work.. as long as the allcoator is "live", its allocations are live.  once it is destructe

Re: [PATCH] irange_pool class

2020-09-18 Thread Martin Sebor via Gcc-patches
On 9/18/20 11:36 AM, Andrew MacLeod wrote: On 9/18/20 1:07 PM, Martin Sebor wrote: On 9/18/20 8:10 AM, Aldy Hernandez via Gcc-patches wrote: On 9/18/20 2:28 PM, David Malcolm wrote: On Fri, 2020-09-18 at 07:49 +0200, Aldy Hernandez wrote: On 9/18/20 3:43 AM, David Malcolm wrote: On Thu

Re: [PATCH] irange_pool class

2020-09-18 Thread Martin Sebor via Gcc-patches
On 9/18/20 8:10 AM, Aldy Hernandez via Gcc-patches wrote: On 9/18/20 2:28 PM, David Malcolm wrote: On Fri, 2020-09-18 at 07:49 +0200, Aldy Hernandez wrote: On 9/18/20 3:43 AM, David Malcolm wrote: On Thu, 2020-09-17 at 12:36 +0200, Aldy Hernandez via Gcc-patches wrote: This is the irange s

Re: [PATCH] warn for integer overflow in allocation calls (PR 96838)

2020-09-17 Thread Martin Sebor via Gcc-patches
On 9/17/20 12:39 PM, Andrew MacLeod wrote: On 9/17/20 12:08 PM, Martin Sebor via Gcc-patches wrote: On 9/16/20 9:23 PM, Jeff Law wrote: On 9/15/20 1:47 PM, Martin Sebor wrote: Overflowing the size of a dynamic allocation (e.g., malloc or VLA) can lead to a subsequent buffer overflow

Re: [PATCH] irange_pool class

2020-09-17 Thread Martin Sebor via Gcc-patches
On 9/17/20 4:36 AM, Aldy Hernandez via Gcc-patches wrote: This is the irange storage class.  It is used to allocate the minimum amount of storage needed for a given irange.  Storage is automatically freed at destruction. It is meant for long term storage, as opposed to int_range_max which is

Re: [PATCH] warn for integer overflow in allocation calls (PR 96838)

2020-09-17 Thread Martin Sebor via Gcc-patches
On 9/16/20 9:23 PM, Jeff Law wrote: On 9/15/20 1:47 PM, Martin Sebor wrote: Overflowing the size of a dynamic allocation (e.g., malloc or VLA) can lead to a subsequent buffer overflow corrupting the heap or stack.  The attached patch diagnoses a subset of these cases where the overflow

Re: [PING][PATCH] improve validation of attribute arguments (PR c/78666)

2020-09-16 Thread Martin Sebor via Gcc-patches
On 9/15/20 5:15 PM, Joseph Myers wrote: On Wed, 9 Sep 2020, Martin Sebor via Gcc-patches wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552500.html Aldy provided a bunch of comments on this patch but I'm still looking for a formal approval. This patch is OK.

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-16 Thread Martin Sebor via Gcc-patches
On 9/15/20 5:02 PM, Joseph Myers wrote: On Wed, 9 Sep 2020, Martin Sebor via Gcc-patches wrote: Joseph, do you have any concerns with or comments on the most recent patch or is it okay as is? https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552266.html I'm not yet convinced b

[PATCH] warn for integer overflow in allocation calls (PR 96838)

2020-09-15 Thread Martin Sebor via Gcc-patches
Overflowing the size of a dynamic allocation (e.g., malloc or VLA) can lead to a subsequent buffer overflow corrupting the heap or stack. The attached patch diagnoses a subset of these cases where the overflow/wraparound is still detectable. Besides regtesting GCC on x86_64-linux I also verified

[PATCH] work harder to avoid -Wuninitialized for empty structs (PR 96295)

2020-09-15 Thread Martin Sebor via Gcc-patches
The -Wuninitialized/-Wmaybe-uninitialized enhancement to warn when a pointer or reference to an uninitialized object is passed to a const-qualified function argument tries to avoid triggering for objects of empty types. However, the suppression is incomplete and lets the warning trigger in some c

[PATCH] document -Wuninitialized for allocated objects

2020-09-15 Thread Martin Sebor via Gcc-patches
The attached patch updates the manual to mention that Wuninitialized and -Wmaybe-uninitialized are issued for both auto and allocated objects, as well as for passing pointers to uninitialized objects to const-qualified parameters. Both of these features are GCC 11 enhancements. Martin Document -

Re: [PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-09-14 Thread Martin Sebor via Gcc-patches
On 9/4/20 11:14 AM, Jason Merrill wrote: On 9/3/20 2:44 PM, Martin Sebor wrote: On 9/1/20 1:22 PM, Jason Merrill wrote: On 8/11/20 12:19 PM, Martin Sebor via Gcc-patches wrote: -Wplacement-new handles array indices and pointer offsets the same: by adjusting them by the size of the element

[PATCH] correct offset range adjustment in compute_objsize (PR 96903)

2020-09-09 Thread Martin Sebor via Gcc-patches
In a recent change I added an incorrect adjustment to the conversion of an offset range with inverted bounds (i.e., upper less than lower) that caused a regression I overlooked in testing. Attached is a fix for this tested on x86_64-linux, and with a more comprehensive test. I plan to commit thi

[PING][PATCH] improve validation of attribute arguments (PR c/78666)

2020-09-09 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552500.html Aldy provided a bunch of comments on this patch but I'm still looking for a formal approval. Martin On 8/24/20 10:45 AM, Martin Sebor wrote: On 8/24/20 4:59 AM, Aldy Hernandez wrote: On 8/21/20 1:37 AM, Martin

[PING][PATCH] use get_size_range to get allocated size (PR 92942)

2020-09-09 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552903.html On 8/28/20 11:12 AM, Martin Sebor wrote: The gimple_call_alloc_size() function that determines the range of sizes of allocated objects and constrains the bounds in calls to functions like memcpy calls get_range() instead of

[PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-09 Thread Martin Sebor via Gcc-patches
Joseph, do you have any concerns with or comments on the most recent patch or is it okay as is? https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552266.html Martin On 9/2/20 6:03 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552266.html On 8/25/20

Re: [RFC Patch] mklog.py: Parse first 10 lines for PR/DR number

2020-09-08 Thread Martin Sebor via Gcc-patches
On 9/8/20 3:47 AM, Tobias Burnus wrote: Hi Martin, hi all, currently, mklog searches for "PR" (and "DR") only in the first line of a new 'testsuite' file. I think in many cases, the PR is listed a bit later than the first line – although, it is usually in the first few lines; in my example, it

Re: [PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-09-03 Thread Martin Sebor via Gcc-patches
On 9/1/20 1:22 PM, Jason Merrill wrote: On 8/11/20 12:19 PM, Martin Sebor via Gcc-patches wrote: -Wplacement-new handles array indices and pointer offsets the same: by adjusting them by the size of the element.  That's correct for the latter but wrong for the former, causing false posi

[PING][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-02 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552266.html On 8/25/20 12:44 PM, Martin Sebor wrote: Joseph, do you have any more comments on the rest of the most recent revision of the patch? https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552266.html Martin On 8/19/20 6

Re: [PATCH] separate reading past the end from -Wstringop-overflow

2020-09-01 Thread Martin Sebor via Gcc-patches
On 9/1/20 4:22 PM, Jeff Law wrote: On Tue, 2020-09-01 at 16:13 -0600, Martin Sebor wrote: On 9/1/20 2:09 AM, Christophe Lyon wrote: On Mon, 31 Aug 2020 at 23:50, Martin Sebor wrote: On 8/31/20 4:51 AM, Christophe Lyon wrote: Hi, ... I pushed a small aarch64 patch as obvious: 2020

Re: [PATCH] separate reading past the end from -Wstringop-overflow

2020-09-01 Thread Martin Sebor via Gcc-patches
On 9/1/20 2:09 AM, Christophe Lyon wrote: On Mon, 31 Aug 2020 at 23:50, Martin Sebor wrote: On 8/31/20 4:51 AM, Christophe Lyon wrote: Hi, ... I pushed a small aarch64 patch as obvious: 2020-08-31 Christophe Lyon gcc/testsuite/ * gcc.target/aarch64

[committed] improve handling of offset wraparound in -Wstringop-overread

2020-09-01 Thread Martin Sebor via Gcc-patches
ILP32 failures in a test added for the new -Wstringop-overread option exposed an unnecessarily restrictive handling of offsets in ranges with an upper bound that's apparently less than the lower bound. I have relaxed the handling of this case to avoid these failures and improve the efficacy of bo

Re: [PATCH] separate reading past the end from -Wstringop-overflow

2020-08-31 Thread Martin Sebor via Gcc-patches
On 8/31/20 3:50 PM, Martin Sebor wrote: On 8/31/20 4:51 AM, Christophe Lyon wrote: Hi, ... I pushed a small aarch64 patch as obvious: 2020-08-31  Christophe Lyon  gcc/testsuite/ * gcc.target/aarch64/strcmpopt_6.c: Suppress -Wstringop-overread. (same as you added

Re: [PATCH] separate reading past the end from -Wstringop-overflow

2020-08-31 Thread Martin Sebor via Gcc-patches
On 8/31/20 4:51 AM, Christophe Lyon wrote: Hi, ... I pushed a small aarch64 patch as obvious: 2020-08-31 Christophe Lyon gcc/testsuite/ * gcc.target/aarch64/strcmpopt_6.c: Suppress -Wstringop-overread. (same as you added for i386) Thank you! On arm, there is a

[committed] use get_size_range instead of get_range to obtain range of valid sizes

2020-08-30 Thread Martin Sebor via Gcc-patches
The get_size_range() function is more appropriate to call than get_range() in contexts where the range of object sizes is needed because (as also mentioned in the patch for PR 92942 I submitted last Friday) it has the necessary logic to constrain the range to just the values that are valid for ob

[PATCH] use get_size_range to get allocated size (PR 92942)

2020-08-28 Thread Martin Sebor via Gcc-patches
The gimple_call_alloc_size() function that determines the range of sizes of allocated objects and constrains the bounds in calls to functions like memcpy calls get_range() instead of get_size_range() to obtain its result. The latter is the right function to call because it has the necessary logic

[PING 2][PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-08-28 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551783.html On 8/19/20 9:00 AM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551783.html On 8/11/20 10:19 AM, Martin Sebor wrote: -Wplacement-new handles array indices and pointer offsets the same

Re: [PATCH 1/3] vec: add exact argument for various grow functions.

2020-08-28 Thread Martin Sebor via Gcc-patches
On 8/28/20 12:49 AM, Martin Liška wrote: On 8/28/20 1:29 AM, Martin Sebor wrote: With --enable-valgrind-annotations the change to the member function signature in this patch triggers compilation errors during bootstrap: I must confirm I didn't tested the configuration. Feel free to in

Re: [PATCH 1/3] vec: add exact argument for various grow functions.

2020-08-27 Thread Martin Sebor via Gcc-patches
With --enable-valgrind-annotations the change to the member function signature in this patch triggers compilation errors during bootstrap: /src/gcc/trunk/gcc/ggc-common.c: In function ‘void gt_pch_save(FILE*)’: /src/gcc/trunk/gcc/ggc-common.c:509:33: error: no matching function for call to ‘vec:

[PATCH] avoid erroneous argument types when checking built-in signatures (PR c/96596)

2020-08-27 Thread Martin Sebor via Gcc-patches
The attached change has match_builtin_function_types() fail for erroneous argument types to prevent an ICE due to assuming they are necessarily valid. Martin PR c/96596 - ICE in match_builtin_function_types on a declaration of a built-in with invalid array argument gcc/c/ChangeLog: PR c/96596

Re: RFQ: -R remark options

2020-08-26 Thread Martin Sebor via Gcc-patches
On 8/26/20 7:37 AM, Nathan Sidwell wrote: Hi, I had a need to add a new type of informative message on the modules branch, with an option to enable it.  The message is not a warning or an error, but just 'hey, you asked if X happens.  It happens just here'. This is emitted as a note.  I chose

Re: [PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-08-25 Thread Martin Sebor via Gcc-patches
Joseph, do you have any more comments on the rest of the most recent revision of the patch? https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552266.html Martin On 8/19/20 6:09 PM, Joseph Myers wrote: On Wed, 19 Aug 2020, Martin Sebor via Gcc-patches wrote: I think you need a while loop

[PING #5][PATCH] separate reading past the end from -Wstringop-overflow

2020-08-24 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548786.html On 8/10/20 10:48 AM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548786.html On 7/26/20 11:42 AM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548786.html

Re: [PATCH] improve validation of attribute arguments (PR c/78666)

2020-08-24 Thread Martin Sebor via Gcc-patches
On 8/24/20 4:59 AM, Aldy Hernandez wrote: On 8/21/20 1:37 AM, Martin Sebor wrote: On 8/20/20 3:00 PM, Aldy Hernandez wrote: Regardless, here are some random comments. Thanks for the careful review! diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 37214831538

Re: [PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-08-21 Thread Martin Sebor via Gcc-patches
On 8/19/20 6:09 PM, Joseph Myers wrote: On Wed, 19 Aug 2020, Martin Sebor via Gcc-patches wrote: I think you need a while loop there, not just an if, to account for the case of multiple consecutive cdk_attrs. At least the GNU attribute syntax direct-declarator: [...] ( gnu

Re: [PATCH] improve validation of attribute arguments (PR c/78666)

2020-08-20 Thread Martin Sebor via Gcc-patches
On 8/20/20 3:00 PM, Aldy Hernandez wrote: First, didn't Marek say in the PR that the diagnostic code should go in diagnose_mismatched_attributes? My understanding of the structure of the attribute handling code is that with just a few exceptions, for C and C++ it's pretty much all in c-attribs.

Re: [PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-08-19 Thread Martin Sebor via Gcc-patches
On 8/17/20 4:09 PM, Joseph Myers wrote: On Thu, 13 Aug 2020, Martin Sebor via Gcc-patches wrote: * Maybe cdk_pointer is followed by cdk_attrs before cdk_id. In this case the code won't return. I think I see the problem you're pointing out (I just don't see how to trigger it

[PING][PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-08-19 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551783.html On 8/11/20 10:19 AM, Martin Sebor wrote: -Wplacement-new handles array indices and pointer offsets the same: by adjusting them by the size of the element.  That's correct for the latter but wrong for the former, ca

[committed] use byte_representation instead of string_constant (PR 96670)

2020-08-18 Thread Martin Sebor via Gcc-patches
The recent enhancement to memchr/memcmp folding introduced two bugs (that I know of). The attached patch fixes the one where a call to the string_constant function that would previously be guaranteed to succeed now fails as a result of the function only handling strings and not other types. The

Re: [PATCH] improve memcmp and memchr constant folding (PR 78257)

2020-08-18 Thread Martin Sebor via Gcc-patches
On 8/15/20 8:19 AM, Christophe Lyon wrote: Hi Martin, On Sat, 15 Aug 2020 at 01:14, Martin Sebor via Gcc-patches wrote: On 8/13/20 11:44 AM, Martin Sebor wrote: On 8/13/20 10:21 AM, Jeff Law wrote: On Fri, 2020-07-31 at 17:55 -0600, Martin Sebor via Gcc-patches wrote: The folders for

[committed] update native_encode_expr description

2020-08-18 Thread Martin Sebor via Gcc-patches
I committed the change below updating and completing the description of the native_encode_expr function. Martin diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9fc4c2a06fb..7c4d1eff215 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7875,11 +7875,12 @@ native_encode_string (const

Re: [PATCH] improve memcmp and memchr constant folding (PR 78257)

2020-08-14 Thread Martin Sebor via Gcc-patches
On 8/13/20 11:44 AM, Martin Sebor wrote: On 8/13/20 10:21 AM, Jeff Law wrote: On Fri, 2020-07-31 at 17:55 -0600, Martin Sebor via Gcc-patches wrote: The folders for these functions (and some others) call c_getsr which relies on string_constant to return the representation of constant strings

Re: [PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-08-13 Thread Martin Sebor via Gcc-patches
On 8/12/20 5:19 PM, Joseph Myers wrote: On Fri, 7 Aug 2020, Martin Sebor via Gcc-patches wrote: I don't see anything in the tests in this patch to cover this sort of case (arrays of pointers, including arrays of pointers to arrays etc.). I've added a few test cases and re

Re: [PATCH] improve memcmp and memchr constant folding (PR 78257)

2020-08-13 Thread Martin Sebor via Gcc-patches
On 8/13/20 10:21 AM, Jeff Law wrote: On Fri, 2020-07-31 at 17:55 -0600, Martin Sebor via Gcc-patches wrote: The folders for these functions (and some others) call c_getsr which relies on string_constant to return the representation of constant strings. Because the function doesn't h

Re: [PATCH 1/3] vec: add exact argument for various grow functions.

2020-08-12 Thread Martin Sebor via Gcc-patches
On 8/12/20 6:28 AM, Martin Liška wrote: On 8/11/20 4:58 PM, Martin Sebor wrote: On 8/11/20 5:36 AM, Martin Liška wrote: Hello. All right, I did it in 3 steps: 1) - new exact argument is added (no default value) - I tested the on x86_64-linux-gnu and I build all cross targets. 2) set default

[PATCH] correct handling of indices into arrays with elements larger than 1 (PR c++/96511)

2020-08-11 Thread Martin Sebor via Gcc-patches
-Wplacement-new handles array indices and pointer offsets the same: by adjusting them by the size of the element. That's correct for the latter but wrong for the former, causing false positives when the element size is greater than one. In addition, the warning doesn't even attempt to handle arr

Re: [PATCH 1/3] vec: add exact argument for various grow functions.

2020-08-11 Thread Martin Sebor via Gcc-patches
On 8/11/20 5:36 AM, Martin Liška wrote: Hello. All right, I did it in 3 steps: 1) - new exact argument is added (no default value) - I tested the on x86_64-linux-gnu and I build all cross targets. 2) set default value of exact = false 3) change places which calculate its own growth to use the

Re: [PATCH] Rewrite get_size_range for irange API.

2020-08-10 Thread Martin Sebor via Gcc-patches
On 8/10/20 2:08 PM, Andrew MacLeod wrote: On 8/10/20 2:46 PM, Martin Sebor wrote: On 8/10/20 11:50 AM, Andrew MacLeod wrote: On 8/10/20 12:35 PM, Martin Sebor via Gcc-patches wrote: On 8/10/20 5:47 AM, Aldy Hernandez wrote: int_range is the type which allows for up to X subranges

Re: [PATCH] Rewrite get_size_range for irange API.

2020-08-10 Thread Martin Sebor via Gcc-patches
On 8/10/20 11:50 AM, Andrew MacLeod wrote: On 8/10/20 12:35 PM, Martin Sebor via Gcc-patches wrote: On 8/10/20 5:47 AM, Aldy Hernandez wrote: On 8/6/20 9:30 PM, Martin Sebor wrote: On 8/6/20 8:53 AM, Aldy Hernandez via Gcc-patches wrote: +  // Remove the unknown parts of a multi-range

[PING 3][PATCH] improve validation of attribute arguments (PR c/78666)

2020-08-10 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549686.html On 7/26/20 11:41 AM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549686.html On 7/16/20 4:53 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549686.html

[PING #4][PATCH] separate reading past the end from -Wstringop-overflow

2020-08-10 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548786.html On 7/26/20 11:42 AM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548786.html On 7/13/20 6:05 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548786.html

[PING][PATCH] improve memcmp and memchr constant folding (PR 78257)

2020-08-10 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/551152.html On 7/31/20 5:55 PM, Martin Sebor wrote: The folders for these functions (and some others) call c_getsr which relies on string_constant to return the representation of constant strings.  Because the function doesn't h

Re: [PATCH] Rewrite get_size_range for irange API.

2020-08-10 Thread Martin Sebor via Gcc-patches
On 8/10/20 5:47 AM, Aldy Hernandez wrote: On 8/6/20 9:30 PM, Martin Sebor wrote: On 8/6/20 8:53 AM, Aldy Hernandez via Gcc-patches wrote: +  // Remove the unknown parts of a multi-range. +  // This will transform [5,10][20,MAX] into [5,10]. Is this comment correct?  Wouldn't this r

Re: [PATCH 1/5] infrastructure to detect out-of-bounds accesses to array parameters

2020-08-07 Thread Martin Sebor via Gcc-patches
On 7/28/20 7:16 PM, Martin Sebor wrote: Patch 1 adds the basic infrastructure to support array/VLA bounds in attribute access.  It extends the access string specification to describe function parameters of array types (including VLAs), extends the attr_access class to parse the string and store

Re: [PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-08-07 Thread Martin Sebor via Gcc-patches
On 7/29/20 12:12 PM, Joseph Myers wrote: On Tue, 28 Jul 2020, Martin Sebor via Gcc-patches wrote: + /* A list of VLA variable bounds or null if not specified. */ + tree vbchain = NULL_TREE; + if (parm->declarator->kind == cdk_array) + if (pd->kind != cdk_array) +

Re: [PATCH] Rewrite get_size_range for irange API.

2020-08-06 Thread Martin Sebor via Gcc-patches
On 8/6/20 8:53 AM, Aldy Hernandez via Gcc-patches wrote: [Martin, does this sound reasonable to you?] It mostly makes sense to me except one part: The following patch converts get_size_range to the irange API, thus removing the use of VR_ANTI_RANGE. This was a bit tricky because of the gymn

Re: [committed] libstdc++: Replace operator>>(istream&, char*) [LWG 2499]

2020-08-06 Thread Martin Sebor via Gcc-patches
On 8/6/20 10:00 AM, Jonathan Wakely wrote: On 06/08/20 09:17 -0600, Martin Sebor via Libstdc++ wrote: Sorry.  I don't see this exercise as a complete waste of time (but I understand why it feels like that to you). What it highlights is the fact that the warning infrastructure we have in

Re: [committed] libstdc++: Replace operator>>(istream&, char*) [LWG 2499]

2020-08-06 Thread Martin Sebor via Gcc-patches
On 8/6/20 8:45 AM, Jonathan Wakely via Libstdc++ wrote: On 06/08/20 15:01 +0100, Jonathan Wakely wrote: On 06/08/20 15:26 +0200, Jakub Jelinek via Libstdc++ wrote: On Thu, Aug 06, 2020 at 02:14:48PM +0100, Jonathan Wakely wrote:  template    __attribute__((__nonnull__(2), __access__(__write_on

Re: [committed] libstdc++: Replace operator>>(istream&, char*) [LWG 2499]

2020-08-06 Thread Martin Sebor via Gcc-patches
On 8/6/20 7:30 AM, Jonathan Wakely via Libstdc++ wrote: On 06/08/20 14:14 +0100, Jonathan Wakely via Libstdc++ wrote: On 05/08/20 16:31 -0600, Martin Sebor via Libstdc++ wrote: On 8/5/20 3:25 PM, Jonathan Wakely wrote: P0487R1 resolved LWG 2499 for C++20 by removing the operator>> ove

Re: [committed] libstdc++: Replace operator>>(istream&, char*) [LWG 2499]

2020-08-05 Thread Martin Sebor via Gcc-patches
On 8/5/20 3:25 PM, Jonathan Wakely wrote: P0487R1 resolved LWG 2499 for C++20 by removing the operator>> overloads that have high risk of buffer overflows. They were replaced by equivalents that only accept a reference to an array, and so can guarantee not to write past the end of the array. In

Re: [PATCH] Adjust tree-ssa-strlen.c for irange API.

2020-08-04 Thread Martin Sebor via Gcc-patches
On 8/4/20 3:23 PM, Aldy Hernandez wrote: On 8/4/20 9:34 PM, Martin Sebor wrote: On 8/4/20 5:33 AM, Aldy Hernandez via Gcc-patches wrote: This patch adapts the strlen pass to use the irange API. I wasn't able to remove the one annoying use of VR_ANTI_RANGE, because I'm not sure

Re: [PATCH] Adjust tree-ssa-strlen.c for irange API.

2020-08-04 Thread Martin Sebor via Gcc-patches
On 8/4/20 5:33 AM, Aldy Hernandez via Gcc-patches wrote: This patch adapts the strlen pass to use the irange API. I wasn't able to remove the one annoying use of VR_ANTI_RANGE, because I'm not sure what to do. Perhaps Martin can shed some light. The current code has: else if (rng == VR_ANT

Re: [PATCH] Adjust gimple-ssa-sprintf.c for irange API.

2020-08-04 Thread Martin Sebor via Gcc-patches
On 8/4/20 8:11 AM, Aldy Hernandez wrote: On Tue, Aug 4, 2020 at 3:59 PM Martin Sebor wrote: On 8/4/20 5:21 AM, Aldy Hernandez via Gcc-patches wrote: This is a rather obvious patch, but I'd like a nod before committing. Martin, I've removed your anti-range check, as it is subsu

Re: [PATCH] Adjust gimple-ssa-sprintf.c for irange API.

2020-08-04 Thread Martin Sebor via Gcc-patches
On 8/4/20 5:21 AM, Aldy Hernandez via Gcc-patches wrote: This is a rather obvious patch, but I'd like a nod before committing. Martin, I've removed your anti-range check, as it is subsumed by the lower_bound/upper_bound code. However, you will have to adapt the code for multi-ranges if desired.

[PATCH] improve memcmp and memchr constant folding (PR 78257)

2020-07-31 Thread Martin Sebor via Gcc-patches
The folders for these functions (and some others) call c_getsr which relies on string_constant to return the representation of constant strings. Because the function doesn't handle constants of other types, including aggregates, memcmp or memchr calls involving those are not folded when they coul

Re: [PATCH] avoid -Wnonnull on synthesized condition in static_cast (PR 96003)

2020-07-31 Thread Martin Sebor via Gcc-patches
On 7/30/20 1:47 PM, Jason Merrill wrote: On 7/30/20 12:25 PM, Martin Sebor wrote: On 7/29/20 2:27 PM, Jason Merrill wrote: On 7/23/20 3:08 PM, Martin Sebor wrote: Another test case added to the bug since I posted the patch shows that the no-warning bit set by the C++ front end is easily lost

Re: [PATCH] avoid -Wnonnull on synthesized condition in static_cast (PR 96003)

2020-07-30 Thread Martin Sebor via Gcc-patches
On 7/29/20 2:27 PM, Jason Merrill wrote: On 7/23/20 3:08 PM, Martin Sebor wrote: Another test case added to the bug since I posted the patch shows that the no-warning bit set by the C++ front end is easily lost during early folding, triggering the -Wnonull again despite the suppression.  The

Re: RFC: Monitoring old PRs, new dg directives

2020-07-29 Thread Martin Sebor via Gcc-patches
I've created a much more rudimentary setup for myself to deal with the same problem. I copy tests from Bugzilla, sometimes with tweaks, and compile them from time to time as I revisit unresolved bugs. I've also thought about adding those to the test suite and marking them XFAIL but I don't think

[PATCH 5/5] extend -Warray-bounds to detect out-of-bounds accesses to array parameters

2020-07-28 Thread Martin Sebor via Gcc-patches
Patch 5 adds support for -Warray-bounds to detect out of bounds accesses in functions that take array/VLA arguments. The changes also enable the warning for dynamically allocated memory and with it the detection of accesses that are only partially out of bounds (e.g., accessing a four byte int in

[PATCH 4/5] - extend -Wstringop-overflow to detect out-of-bounds accesses to array parameters

2020-07-28 Thread Martin Sebor via Gcc-patches
Patch 4 adds support to the machinery behind -Wstringop-overflow to issue warnings for (likely) out of bounds accesses in calls to functions with the internal attribute access specification. This implements the feature pr50584 asks for (plus more). [4/5] - Extend -Wstringop-overflow to detect out

[PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-07-28 Thread Martin Sebor via Gcc-patches
Patch 2 adds support for the internal attribute access specification for array/VLA parameters to the C front end and two new options to control warnings. The attribute is added in two steps: first, push_parm_decl adds a new attribute "arg spec" to each array parameter with a string describing its

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