Re: [PATCH] cache compute_objsize results in strlen/sprintf (PR 97373)

2020-11-05 Thread Martin Sebor via Gcc-patches
On 11/5/20 12:31 AM, Richard Biener wrote: On Thu, Nov 5, 2020 at 1:59 AM Martin Sebor via Gcc-patches wrote: To determine the target of a pointer expression and the offset into it, the increasingly widely used compute_objsize function traverses the IL following the DEF statements of pointer

Re: [PATCH] cache compute_objsize results in strlen/sprintf (PR 97373)

2020-11-05 Thread Martin Sebor via Gcc-patches
On 11/5/20 8:29 AM, Jakub Jelinek wrote: On Thu, Nov 05, 2020 at 08:20:20AM -0700, Martin Sebor via Gcc-patches wrote: compute_objsize() and the objsz pass are completely independent. The pass is also quite limited in that it doesn't make use of ranges. That limitation was also the main r

Re: [PATCH] generalized range_query class for multiple contexts

2020-11-05 Thread Martin Sebor via Gcc-patches
On 10/1/20 11:25 AM, Martin Sebor wrote: 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 q

Re: [PATCH] generalized range_query class for multiple contexts

2020-11-05 Thread Martin Sebor via Gcc-patches
On 11/5/20 12:29 PM, Martin Sebor wrote: On 10/1/20 11:25 AM, Martin Sebor wrote: 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 unde

Re: [PATCH] generalized range_query class for multiple contexts

2020-11-05 Thread Martin Sebor via Gcc-patches
On 11/5/20 5:02 PM, Andrew MacLeod wrote: On 11/5/20 4:02 PM, Martin Sebor wrote: On 11/5/20 12:29 PM, Martin Sebor wrote: On 10/1/20 11:25 AM, Martin Sebor wrote: 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 G

Re: [PATCH] generalized range_query class for multiple contexts

2020-11-06 Thread Martin Sebor via Gcc-patches
On 11/5/20 8:08 PM, Andrew MacLeod wrote: On 11/5/20 7:50 PM, Martin Sebor wrote: On 11/5/20 5:02 PM, Andrew MacLeod wrote: On 11/5/20 4:02 PM, Martin Sebor wrote: On 11/5/20 12:29 PM, Martin Sebor wrote: On 10/1/20 11:25 AM, Martin Sebor wrote: On 10/1/20 9:34 AM, Aldy Hernandez wrote: O

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

2020-11-09 Thread Martin Sebor via Gcc-patches
2: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 corrupting the heap or stack.  The attached patch diagnoses a subset

Re: [PATCH] generalized range_query class for multiple contexts

2020-11-10 Thread Martin Sebor via Gcc-patches
On 11/6/20 2:54 PM, Andrew MacLeod wrote: On 11/6/20 11:13 AM, Martin Sebor wrote: On 11/5/20 8:08 PM, Andrew MacLeod wrote: On 11/5/20 7:50 PM, Martin Sebor wrote: On 11/5/20 5:02 PM, Andrew MacLeod wrote: On 11/5/20 4:02 PM, Martin Sebor wrote: On 11/5/20 12:29 PM, Martin Sebor wrote: On

[PATCH] detect allocation/deallocation mismatches in user-defined functions (PR94527)

2020-11-13 Thread Martin Sebor via Gcc-patches
Bug 94527 is request from the kernel developers for an attribute to indicate that a user-defined function deallocates an object allocated by an earlier call to an allocation function. Their goal is to detect misuses of such functions and the pointers or objects returned from them. The recently s

[PATCH] introduce --param max-object-size

2020-11-14 Thread Martin Sebor via Gcc-patches
GCC considers PTRDIFF_MAX - 1 to be the size of the largest object so that the difference between a pointer to the byte just past its end and the first one is no more than PTRDIFF_MAX. This is too liberal in LP64 on most systems because the size of the address space is constrained to much less th

Re: [PATCH] c++: Implement -Wuninitialized for mem-initializers [PR19808]

2020-11-16 Thread Martin Sebor via Gcc-patches
On 11/15/20 3:44 PM, Marek Polacek via Gcc-patches wrote: This patch implements the long-desired -Wuninitialized warning for member initializer lists, so that the front end can detect bugs like struct A { int a; int b; A() : b(1), a(b) { } }; where the field 'b' is used uni

[PATCH] use is_empty_type to check for empty types (PR 97840)

2020-11-16 Thread Martin Sebor via Gcc-patches
The -Wmaybe-uninitialized enhancement to warn when the address of an uninitialized object is passed to a function taking a const pointer (or, in C++, a const reference) tries to avoid triggering when the address is that of an empty object. It does that by checking EMPTY_TYPE_P() and default_is_em

Re: [PATCH] RFC: add "deallocated_by" attribute for use by analyzer

2020-11-16 Thread Martin Sebor via Gcc-patches
On 11/13/20 2:44 PM, Jeff Law via Gcc-patches wrote: On 10/5/20 5:12 PM, David Malcolm via Gcc-patches wrote: This work-in-progress patch generalizes the malloc/free problem-checking in -fanalyzer so that it can work on arbitrary acquire/release API pairs. It adds a new __attribute__((dealloca

[PATCH] use TYPE_SIZE instead of DECL_SIZE for classes (PR 97595)

2020-11-16 Thread Martin Sebor via Gcc-patches
The result of DECL_SIZE_UNIT doesn't always reflect the size of data members of virtual classes. This can lead to objects of such types appearing smaller than they are to warnings like -Warray-bounds or -Wstringop-overflow, causing false positives. To avoid these false positives, the attached re

Re: [PATCH] c++: Implement -Wuninitialized for mem-initializers [PR19808]

2020-11-16 Thread Martin Sebor via Gcc-patches
On 11/16/20 12:02 PM, Jason Merrill wrote: On 11/16/20 12:42 PM, Martin Sebor wrote: On 11/15/20 3:44 PM, Marek Polacek via Gcc-patches wrote: This patch implements the long-desired -Wuninitialized warning for member initializer lists, so that the front end can detect bugs like    struct A {  

[PATCH] warn for more impossible null pointer tests

2021-08-31 Thread Martin Sebor via Gcc-patches
A Coverity run recently uncovered a latent bug in GCC that GCC should be able to detect itself: comparing the address of a declared object for equality to null, similar to: int f (void) { int a[2][2]; return &a == 0; } GCC issues -Waddress for this code, but the bug Coverity found

Re: [PATCH] warn for more impossible null pointer tests

2021-09-01 Thread Martin Sebor via Gcc-patches
On 9/1/21 1:21 PM, Jason Merrill wrote: On 8/31/21 10:08 PM, Martin Sebor wrote: A Coverity run recently uncovered a latent bug in GCC that GCC should be able to detect itself: comparing the address of a declared object for equality to null, similar to:    int f (void)    { int a[2][2];   

Re: [PATCH] warn for more impossible null pointer tests

2021-09-01 Thread Martin Sebor via Gcc-patches
On 9/1/21 3:39 PM, Jason Merrill wrote: On 9/1/21 4:33 PM, Martin Sebor wrote: On 9/1/21 1:21 PM, Jason Merrill wrote: On 8/31/21 10:08 PM, Martin Sebor wrote: A Coverity run recently uncovered a latent bug in GCC that GCC should be able to detect itself: comparing the address of a declared ob

Re: [PATCH 1/13] v2 [PATCH 1/13] Add support for per-location warning groups (PR 74765)

2021-09-01 Thread Martin Sebor via Gcc-patches
On 9/1/21 1:35 PM, Thomas Schwinge wrote: Hi! On 2021-06-23T13:47:08-0600, Martin Sebor via Gcc-patches wrote: On 6/22/21 5:28 PM, David Malcolm wrote: On Tue, 2021-06-22 at 19:18 -0400, David Malcolm wrote: On Fri, 2021-06-04 at 15:41 -0600, Martin Sebor wrote: The attached patch

Re: Fix 'hash_table::expand' to destruct stale Value objects

2021-09-01 Thread Martin Sebor via Gcc-patches
On 8/30/21 4:46 AM, Thomas Schwinge wrote: Hi! Ping -- we still need to plug the memory leak; see patch attached, and/or long discussion here: Thanks for answering my questions. I have no concerns with going forward with the patch as is. Just a suggestion/request: unless this patch fixes all

Re: [PATCH] warn for more impossible null pointer tests

2021-09-02 Thread Martin Sebor via Gcc-patches
On 9/2/21 7:43 AM, Jason Merrill wrote: On 9/1/21 6:27 PM, Martin Sebor wrote: On 9/1/21 3:39 PM, Jason Merrill wrote: On 9/1/21 4:33 PM, Martin Sebor wrote: On 9/1/21 1:21 PM, Jason Merrill wrote: On 8/31/21 10:08 PM, Martin Sebor wrote: A Coverity run recently uncovered a latent bug in GCC

Re: [PATCH] improve note location and refactor warn_uninit

2021-09-02 Thread Martin Sebor via Gcc-patches
On 8/27/21 5:23 PM, Jeff Law wrote: On 8/26/2021 1:30 PM, Martin Sebor via Gcc-patches wrote: On 8/26/21 10:38 AM, Martin Sebor wrote: On 8/26/21 1:00 AM, Richard Biener wrote: On Wed, Aug 25, 2021 at 10:03 PM Martin Sebor wrote: Richard, some time ago you mentioned you'd had tr

Re: [PATCH] warn for more impossible null pointer tests [PR102103]

2021-09-02 Thread Martin Sebor via Gcc-patches
Attached is an updated patch with Jason's suggested change to use handled_component_p(), retested on x86_64-linux and with Glibc. Adding more tests led to more changes but hopefully also a better end result. I've changed the warning suppression from a cast to void* to one to intptr_t, in part bec

Re: [PATCH] Implement POINTER_DIFF_EXPR entry in range-op.

2021-09-03 Thread Martin Sebor via Gcc-patches
On 9/3/21 8:41 AM, Aldy Hernandez via Gcc-patches wrote: [Andrew, do you see any problem with using the minus relational code here? It seems like everything matches up.] I've seen cases in the upcoming jump threader enhancements where we see a difference of two pointers that are known to be equ

[PATCH] better handle MIN/MAX_EXPR of unrelated objects [PR102200]

2021-09-16 Thread Martin Sebor via Gcc-patches
When computing the size of an object pointed to by the result of a MIN/MAX_EXPR, the handle_min_max_size() function tries to deal gracefully with operands that designate distinct objects. But the handling fails to consider an edge case when one of the operands is a PHI one of whose operands refer

Re: [PATCH] warn for more impossible null pointer tests [PR102103]

2021-09-17 Thread Martin Sebor via Gcc-patches
On 9/8/21 2:06 PM, Jason Merrill wrote: On 9/2/21 7:53 PM, Martin Sebor wrote: @@ -4622,28 +4622,94 @@ warn_for_null_address (location_t location, tree op, tsubst_flags_t complain)     if (!warn_address     || (complain & tf_warning) == 0     || c_inhibit_evaluation_warnings != 0 - 

Re: [PATCH] introduce predicate analysis class

2021-09-17 Thread Martin Sebor via Gcc-patches
On 9/2/21 10:28 AM, Jeff Law via Gcc-patches wrote: On 8/30/2021 2:03 PM, Martin Sebor via Gcc-patches wrote: The predicate analysis subset of the tree-ssa-uninit pass isn't necessarily specific to the detection of uninitialized reads. Suitably parameterized, the same core logic could be

Re: [PATCH] introduce predicate analysis class

2021-09-18 Thread Martin Sebor via Gcc-patches
On 9/17/21 10:08 PM, Jeff Law wrote: On 9/17/2021 4:05 PM, Martin Sebor wrote: On 9/2/21 10:28 AM, Jeff Law via Gcc-patches wrote: On 8/30/2021 2:03 PM, Martin Sebor via Gcc-patches wrote: The predicate analysis subset of the tree-ssa-uninit pass isn't necessarily specific t

Re: [PATCH] introduce predicate analysis class

2021-09-18 Thread Martin Sebor via Gcc-patches
On 9/18/21 12:46 PM, Martin Sebor wrote: On 9/17/21 10:08 PM, Jeff Law wrote: On 9/17/2021 4:05 PM, Martin Sebor wrote: On 9/2/21 10:28 AM, Jeff Law via Gcc-patches wrote: On 8/30/2021 2:03 PM, Martin Sebor via Gcc-patches wrote: The predicate analysis subset of the tree-ssa-uninit pass

Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.

2021-09-19 Thread Martin Sebor via Gcc-patches
On 9/16/21 3:03 AM, Hongtao Liu via Gcc-patches wrote: On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches wrote: On Thu, 16 Sep 2021, liuhongt wrote: Ping rebased on latest trunk. gcc/ChangeLog: * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). * doc/i

Re: [PATCH] introduce predicate analysis class

2021-09-19 Thread Martin Sebor via Gcc-patches
On 9/18/21 3:14 PM, Martin Sebor wrote: On 9/18/21 12:46 PM, Martin Sebor wrote: On 9/17/21 10:08 PM, Jeff Law wrote: On 9/17/2021 4:05 PM, Martin Sebor wrote: On 9/2/21 10:28 AM, Jeff Law via Gcc-patches wrote: On 8/30/2021 2:03 PM, Martin Sebor via Gcc-patches wrote: The predicate

[committed] avoid assuming cfun is nonnull [PR102243]

2021-09-19 Thread Martin Sebor via Gcc-patches
After the front end passes control to the middle end cfun is never null (I'm pretty sure) but when a middle end helper is called from the C++ front end cfun can be null for a namespace scope initializer expression. A recent change of mine to the helper introduced an assumption to the contrary, ca

Re: [PATCH] warn for more impossible null pointer tests [PR102103]

2021-09-21 Thread Martin Sebor via Gcc-patches
On 9/21/21 3:40 PM, Jason Merrill wrote: On 9/17/21 12:02, Martin Sebor wrote: On 9/8/21 2:06 PM, Jason Merrill wrote: On 9/2/21 7:53 PM, Martin Sebor wrote: @@ -4622,28 +4622,94 @@ warn_for_null_address (location_t location, tree op, tsubst_flags_t complain)     if (!warn_address     ||

Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.

2021-09-22 Thread Martin Sebor via Gcc-patches
On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 --- a/gcc/testsuite/c-c++-common/Wstringop-ov

Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.

2021-09-22 Thread Martin Sebor via Gcc-patches
On 9/22/21 8:21 AM, Martin Sebor wrote: On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 ---

Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.

2021-09-23 Thread Martin Sebor via Gcc-patches
On 9/23/21 12:30 AM, Richard Biener wrote: On Thu, 23 Sep 2021, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... dif

Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.

2021-09-24 Thread Martin Sebor via Gcc-patches
On 9/23/21 9:32 PM, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 11:18 PM Martin Sebor wrote: On 9/23/21 12:30 AM, Richard Biener wrote: On Thu, 23 Sep 2021, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: On 9/2

PING [PATCH] warn for more impossible null pointer tests [PR102103]

2021-09-24 Thread Martin Sebor via Gcc-patches
Ping: Jeff, with the C++ part approved, can you please confirm your approval with the C parts of the patch? https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579693.html On 9/21/21 6:34 PM, Martin Sebor wrote: On 9/21/21 3:40 PM, Jason Merrill wrote: The C++ changes are OK. Jef

Re: [r12-3899 Regression] FAIL: gcc.dg/strlenopt-13.c scan-tree-dump-times strlen1 "memcpy \\(" 7 on Linux/x86_64

2021-09-28 Thread Martin Sebor via Gcc-patches
On 9/28/21 1:20 AM, Richard Biener wrote: On Mon, 27 Sep 2021, sunil.k.pandey wrote: On Linux/x86_64, d06dc8a2c73735e9496f434787ba4c93ceee5eea is the first bad commit commit d06dc8a2c73735e9496f434787ba4c93ceee5eea Author: Richard Biener Date: Mon Sep 27 13:36:12 2021 +0200 middle-end

Re: [patch][gcc12-changes] Add a new item about the support for automatic static variable initialization

2021-09-29 Thread Martin Sebor via Gcc-patches
On 9/28/21 2:31 PM, Qing Zhao via Gcc-patches wrote: Hi, This is the patch for the gcc12 changes per your request. Kees provided most of the wording. Please take a look and let’s know whether it’s good for commit? thanks. Qing From: qing z

Re: [PATCH] c-format: Add -Wformat-same-precision option [PR80060]

2021-09-30 Thread Martin Sebor via Gcc-patches
On 9/26/21 3:52 PM, Daniil Stas via Gcc-patches wrote: This option is enabled by default when -Wformat option is enabled. A user can specify -Wno-format-same-precision to disable emitting warnings about an argument passed to printf-like function having a different type from the one specified in t

PING #2 [PATCH] warn for more impossible null pointer tests [PR102103]

2021-09-30 Thread Martin Sebor via Gcc-patches
Jason, since you approved the C++ changes, would you mind looking over the C bits and if they look good to you giving me the green light to commit the patch? https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579693.html Thanks in advance for your help! On 9/24/21 8:31 AM, Martin Sebor wr

Re: [aarch64] PR102376 - Emit better diagnostic for arch extensions in target attr

2021-10-28 Thread Martin Sebor via Gcc-patches
On 10/28/21 2:59 AM, Prathamesh Kulkarni via Gcc-patches wrote: On Fri, 22 Oct 2021 at 14:41, Prathamesh Kulkarni wrote: On Wed, 20 Oct 2021 at 15:05, Richard Sandiford wrote: Prathamesh Kulkarni writes: On Tue, 19 Oct 2021 at 19:58, Richard Sandiford wrote: Prathamesh Kulkarni writes

Re: [PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread Martin Sebor via Gcc-patches
On 10/28/21 1:23 AM, liuhongt via Gcc-patches wrote: Adjust code in check_vect_slp_aligned_store_usage to make it an exact pattern match of the corresponding testcases. These new target/xfail selectors are added as a temporary solution, and should be removed after real issue is fixed for Wstringo

Re: [Patch] libcpp: Fix _Pragma expansion [PR102409]

2021-10-28 Thread Martin Sebor via Gcc-patches
On 10/28/21 9:51 AM, Tobias Burnus wrote: Before this patch, running #define TEST(T) T #define PARALLEL(X) TEST(X) PARALLEL(     for (int i = 0; i < N; i++) { \   _Pragma("omp ordered") \   S[0] += C[i] + D[i]; \     }) through 'gcc -E' yielded #pragma omp ordered  for (int i = 0;

Re: [PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread Martin Sebor via Gcc-patches
On 10/28/21 7:47 PM, Hongtao Liu wrote: On Fri, Oct 29, 2021 at 12:20 AM Martin Sebor via Gcc-patches wrote: On 10/28/21 1:23 AM, liuhongt via Gcc-patches wrote: Adjust code in check_vect_slp_aligned_store_usage to make it an exact pattern match of the corresponding testcases. These new

[PATCH 0/2] provide simple detection of indeterminate pointers

2021-11-01 Thread Martin Sebor via Gcc-patches
This two-patch series adds support for the detection of uses of pointers invalidated as a result of the lifetime of the objects they point to having ended: either explicitly, after a call to a dynamic deallocation function, or implicitly, by virtue of an object with automatic storage duration havi

[PATCH 1/2] add -Wuse-after-free

2021-11-01 Thread Martin Sebor via Gcc-patches
Patch 1 in the series detects a small subset of uses of pointers made indeterminate by calls to deallocation functions like free or C++ operator delete. To control the conditions the warnings are issued under the new -Wuse-after-free= option provides three levels. At the lowest level the warning

[PATCH 2/2] add -Wdangling-pointer [PR #63272]

2021-11-01 Thread Martin Sebor via Gcc-patches
Patch 2 in this series adds support for detecting the uses of dangling pointers: those to auto objects that have gone out of scope. Like patch 1, to minimize false positives this detection is very simplistic. However, thanks to the more deterministic nature of the problem (all local objects go o

Re: [PATCH] attribs: Allow optional second arg for attr deprecated [PR102049]

2021-11-01 Thread Martin Sebor via Gcc-patches
On 10/11/21 9:17 AM, Marek Polacek via Gcc-patches wrote: Any thoughts? I'm a little unsure. Clang just uses the replacement string as the text of the fix-it note as is, so it does nothing to help programmers make sure the replacement is in sync with what it's supposed to replace. E.g., for t

Re: [PATCH 1/2] add -Wuse-after-free

2021-11-02 Thread Martin Sebor via Gcc-patches
On 11/1/21 11:32 PM, Eric Gallager wrote: On Mon, Nov 1, 2021 at 6:18 PM Martin Sebor via Gcc-patches wrote: Patch 1 in the series detects a small subset of uses of pointers made indeterminate by calls to deallocation functions like free or C++ operator delete. To control the conditions the

Re: [PATCH 2/2] add -Wdangling-pointer [PR #63272]

2021-11-02 Thread Martin Sebor via Gcc-patches
On 11/2/21 1:40 AM, Eric Gallager wrote: On Mon, Nov 1, 2021 at 6:20 PM Martin Sebor via Gcc-patches wrote: Patch 2 in this series adds support for detecting the uses of dangling pointers: those to auto objects that have gone out of scope. Like patch 1, to minimize false positives this

Re: [PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-11-02 Thread Martin Sebor via Gcc-patches
On 10/4/21 4:39 PM, Eric Gallager wrote: On Mon, Oct 4, 2021 at 2:43 PM Martin Sebor via Gcc-patches wrote: While resolving the recent -Waddress enhancement request (PR PR102103) I came across a 2007 problem report about GCC 4 having stopped warning for using the address of inline functions

Re: [PATCH v2] libcpp: Implement -Wbidirectional for CVE-2021-42574 [PR103026]

2021-11-02 Thread Martin Sebor via Gcc-patches
On 11/2/21 11:18 AM, Marek Polacek via Gcc-patches wrote: On Mon, Nov 01, 2021 at 10:10:40PM +, Joseph Myers wrote: On Mon, 1 Nov 2021, Marek Polacek via Gcc-patches wrote: + /* We've read a bidi char, update the current vector as necessary. */ + void on_char (kind k, bool ucn_p) + { +

Re: [PATCH] Initial implementation of -Whomoglyph [PR preprocessor/103027]

2021-11-02 Thread Martin Sebor via Gcc-patches
On 11/1/21 3:14 PM, David Malcolm via Gcc-patches wrote: [Resending to get around mailing list size limit; see notes below] This patch implements a new -Whomoglyph diagnostic, enabled by default. Internally it implements the "skeleton" algorithm from: http://www.unicode.org/reports/tr39/#Con

Re: [PATCH 1/2] add -Wuse-after-free

2021-11-02 Thread Martin Sebor via Gcc-patches
On 11/2/21 4:29 PM, David Malcolm wrote: On Mon, 2021-11-01 at 16:17 -0600, Martin Sebor via Gcc-patches wrote: Patch 1 in the series detects a small subset of uses of pointers made indeterminate by calls to deallocation functions like free or C++ operator delete. To control the conditions the

Re: [PATCH] Add 'no_builtin' function attribute

2021-11-03 Thread Martin Sebor via Gcc-patches
On 11/2/21 3:14 PM, Keith Packard via Gcc-patches wrote: This attribute controls optimizations which make assumptions about the semantics of builtin functions. Typical cases here are code which match memcpy, calloc, sincos, or which call builtins like free. This extends on things like the -ftree

Re: [PATCH] Rename predicate class to ipa_predicate

2021-11-03 Thread Martin Sebor via Gcc-patches
On 11/3/21 4:23 AM, Martin Liška wrote: Hello. The renaming patch fixes a -Wodr warning seen and reported in the PR. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Thanks for handling this! Martin

Re: Invalid -Wstringop-overread warning for valid POSIX constructs

2021-11-04 Thread Martin Sebor via Gcc-patches
On 11/4/21 1:03 AM, Florian Weimer via Libc-alpha wrote: This code: #include #include void f (pthread_key_t key) { pthread_setspecific (key, MAP_FAILED); } Results in a warning: t.c: In function ‘f’: t.c:7:3: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstrin

Re: [PATCH v2] c-format: Add -Wformat-int-precision option [PR80060]

2021-11-04 Thread Martin Sebor via Gcc-patches
On 10/31/21 8:13 AM, Daniil Stas wrote: On Sun, 10 Oct 2021 23:10:20 + Daniil Stas wrote: This option is enabled by default when -Wformat option is enabled. A user can specify -Wno-format-int-precision to disable emitting warnings when passing an argument of an incompatible integer type to

Re: [PATCH] c++, dyninit: Optimize C++ dynamic initialization by constants into DECL_INITIAL adjustment [PR102876]

2021-11-05 Thread Martin Sebor via Gcc-patches
On 11/4/21 3:42 AM, Jakub Jelinek via Gcc-patches wrote: Hi! When users don't use constexpr everywhere in initialization of namespace scope non-comdat vars and the initializers aren't constant when FE is looking at them, the FE performs dynamic initialization of those variables. But after inlini

PING [PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-11-07 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582415.html On 10/23/21 5:06 PM, Martin Sebor wrote: On 10/4/21 3:37 PM, Jason Merrill wrote: On 10/4/21 14:42, Martin Sebor wrote: While resolving the recent -Waddress enhancement request (PR PR102103) I came across a 2007 problem r

Re: [PATCH] c++: Implement -Wuninitialized for mem-initializers (redux) [PR19808]

2021-11-07 Thread Martin Sebor via Gcc-patches
On 11/5/21 5:22 PM, Marek Polacek via Gcc-patches wrote: 2021 update: Last year I posted a version of this patch: but it didn't make it in. The main objection seemed to be that the patch tried to do too much, and overlapped wi

PING [PATCH 0/2] provide simple detection of indeterminate pointers

2021-11-08 Thread Martin Sebor via Gcc-patches
Ping for the two patches below: -Wuse-after-free: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583044.html and -Wdangling-pointer: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583045.html On 11/1/21 4:15 PM, Martin Sebor wrote: This two-patch series adds support for the d

[PATCH] fix up compute_objsize (including PR 103143)

2021-11-08 Thread Martin Sebor via Gcc-patches
The pointer-query code that implements compute_objsize() that's in turn used by most middle end access warnings now has a few warts in it and (at least) one bug. With the exception of the bug the warts aren't behind any user-visible bugs that I know of but they do cause problems in new code I've

[PATCH] implement -Winfinite-recursion [PR88232]

2021-11-09 Thread Martin Sebor via Gcc-patches
The attached patch adds support to the middle end for detecting infinitely recursive calls. The warning is controlled by the new -Winfinite-recursion option. The option name is the same as Clang's. I scheduled the warning pass to run after early inlining to detect mutually recursive calls but b

Re: Get rid of infinite recursion for 'typedef' used with GTY-marked 'gcc/diagnostic-spec.h:nowarn_map' [PR101204]

2021-11-09 Thread Martin Sebor via Gcc-patches
On 11/9/21 3:28 AM, Thomas Schwinge wrote: Hi! On 2021-09-01T18:14:46-0600, Martin Sebor wrote: On 9/1/21 1:35 PM, Thomas Schwinge wrote: On 2021-06-23T13:47:08-0600, Martin Sebor via Gcc-patches wrote: --- /dev/null +++ b/gcc/diagnostic-spec.h +typedef location_t key_type_t; +typedef

Re: [PATCH] testsuite/102690 - XFAIL g++.dg/warn/Warray-bounds-16.C

2021-11-10 Thread Martin Sebor via Gcc-patches
On 11/10/21 3:09 AM, Richard Biener via Gcc-patches wrote: This XFAILs the bogus diagnostic test and rectifies the expectation on the optimization. Tested on x86_64-unknown-linux-gnu, pushed. 2021-11-10 Richard Biener PR testsuite/102690 * g++.dg/warn/Warray-bounds-16.C: XFA

[PATCH v2] implement -Winfinite-recursion [PR88232]

2021-11-11 Thread Martin Sebor via Gcc-patches
On 11/10/21 2:27 PM, Marek Polacek wrote: On Tue, Nov 09, 2021 at 09:28:43PM -0700, Martin Sebor via Gcc-patches wrote: The attached patch adds support to the middle end for detecting infinitely recursive calls. The warning is controlled by the new -Winfinite-recursion option. The option name

[PATCH v2] implement -Winfinite-recursion [PR88232]

2021-11-11 Thread Martin Sebor via Gcc-patches
Attached is a v2 of the solution I posted earlier this week with a few tweaks made after a more careful consideration of the problem and possible false negatives and positives. 1) It avoids warning for [apparently infinitely recursive] calls in noreturn functions where the recursion may be pre

Re: [PATCH] testsuite/102690 - XFAIL g++.dg/warn/Warray-bounds-16.C

2021-11-11 Thread Martin Sebor via Gcc-patches
On 11/11/21 1:18 AM, Richard Biener wrote: On Wed, 10 Nov 2021, Martin Sebor wrote: On 11/10/21 3:09 AM, Richard Biener via Gcc-patches wrote: This XFAILs the bogus diagnostic test and rectifies the expectation on the optimization. Tested on x86_64-unknown-linux-gnu, pushed. 2021-11-10 Rich

Re: Enable more type attributes for signature changes

2021-11-15 Thread Martin Sebor via Gcc-patches
On 11/13/21 7:44 AM, Jan Hubicka wrote: Hi, this patch whitelists attributes that are safe for attribute changes and also makes access attribute dropped if function sigunature is changed. We could do better by updating the attribute, but doing so seems to be bit snowballing since with LTO the war

Re: [ping] Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map'

2021-11-15 Thread Martin Sebor via Gcc-patches
2021-06-23T13:47:08-0600, Martin Sebor via Gcc-patches wrote: --- /dev/null +++ b/gcc/diagnostic-spec.h +typedef location_t key_type_t; +typedef int_hash xint_hash_t; By the way, it seems we should probably also use a manifest constant for Empty (probably UNKNOWN_LOCATION since we&#x

PING 2 [PATCH 0/2] provide simple detection of indeterminate pointers

2021-11-15 Thread Martin Sebor via Gcc-patches
Pinging the two patches below: -Wuse-after-free: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583044.html and -Wdangling-pointer: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583045.html On 11/8/21 3:41 PM, Martin Sebor wrote: Ping for the two patches below: -Wuse-after-

PING [PATCH] fix up compute_objsize (including PR 103143)

2021-11-15 Thread Martin Sebor via Gcc-patches
Ping for the following cleanup patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583735.html On 11/8/21 7:34 PM, Martin Sebor wrote: The pointer-query code that implements compute_objsize() that's in turn used by most middle end access warnings now has a few warts in it and (at leas

PING 2 [PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-11-15 Thread Martin Sebor via Gcc-patches
Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582415.html On 11/7/21 4:31 PM, Martin Sebor wrote: Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582415.html On 10/23/21 5:06 PM, Martin Sebor wrote: On 10/4/21 3:37 PM, Jason Merrill wrote: On 10/4/21 14:42, Martin

[PATCH] Avoid pathological function redeclarations when checking access sizes [PR102759]

2021-11-15 Thread Martin Sebor via Gcc-patches
Declaring a function with a prototype at block scope and then redeclaring it without a prototype at file scope results in losing the prototype but not the attribute access that was implicitly added to the function decl based on the prototype. The middle end code that checks function calls for out-

[PATCH] simplify get_range_strlen interface

2021-11-15 Thread Martin Sebor via Gcc-patches
The deeply nested PHI handling in get_range_strlen_dynamic makes the code bigger and harder to follow than it would be if done in its own function. The attached patch does that. In addition, the get_range_strlen family of functions use a bitmap to avoid infinite recursion. Rather than dynamical

Re: [PATCH] simplify get_range_strlen interface

2021-11-16 Thread Martin Sebor via Gcc-patches
On 11/15/21 3:05 PM, Martin Sebor wrote: The deeply nested PHI handling in get_range_strlen_dynamic makes the code bigger and harder to follow than it would be if done in its own function.  The attached patch does that. In addition, the get_range_strlen family of functions use a bitmap to avoid

[PATCH] handle folded nonconstant array bounds [PR101702]

2021-11-16 Thread Martin Sebor via Gcc-patches
-Warray-parameter and -Wvla-parameter assume that array bounds in function parameters are either constant integers or variable, but not something in between like a cast of a constant that's not recognized as an INTEGER_CST until we strip the cast from it. This leads to an ICE as the the internal

Re: [PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-11-16 Thread Martin Sebor via Gcc-patches
On 11/16/21 1:23 PM, Jason Merrill wrote: On 10/23/21 19:06, Martin Sebor wrote: On 10/4/21 3:37 PM, Jason Merrill wrote: On 10/4/21 14:42, Martin Sebor wrote: While resolving the recent -Waddress enhancement request (PR PR102103) I came across a 2007 problem report about GCC 4 having stopped

Re: [PATCH] c++: Add new warning options for C++ language mismatches

2021-05-19 Thread Martin Sebor via Gcc-patches
On 5/19/21 10:39 AM, Jonathan Wakely via Gcc-patches wrote: Jakub pointed out I'd forgotten the spaces before the opening parens for function calls. The attached patch should fix all those, with no other changes. Tested x86_64-linux. OK for trunk? Looks good to me, it just needs an update to t

[PATCH] handle VLAs with arbitrary many bounds (PR 100619)

2021-05-19 Thread Martin Sebor via Gcc-patches
The GCC 11 -Warray-parameter and -Wvla-parameter enhancement uses a small local buffer to format the description of the VLA bounds for the internal attribute access. When the number of bounds is in excess of the size of the buffer the code asserts as the test case in pr100619 shows. The attached

[PATCH] avoid -Wnonnull with lambda (PR 100684)

2021-05-19 Thread Martin Sebor via Gcc-patches
The front end -Wnonnull handler has code to suppress warning for lambdas with null this pointers but the middle end handler has no corresponding logic. This leads to spurious -Wnonnull in lambda calls that aren't inlined. That might happen at low optimization levels such as -O1 or -Og and with s

Re: [PATCH 1/2] c-family: Copy DECL_USER_ALIGN even if DECL_ALIGN is similar.

2021-05-19 Thread Martin Sebor via Gcc-patches
On 5/3/21 8:53 AM, Robin Dapp via Gcc-patches wrote: Hi, on s390 a warning test fails: inline int ATTR ((cold, aligned (8))) finline_hot_noret_align (int); inline int ATTR ((warn_unused_result)) finline_hot_noret_align (int); inline int ATTR ((aligned (4)))   finline_hot_noret_align (int); 

Re: [PATCH] c++: Add new warning options for C++ language mismatches

2021-05-20 Thread Martin Sebor via Gcc-patches
On 5/20/21 6:56 AM, Jonathan Wakely wrote: On 19/05/21 16:05 -0400, Jason Merrill wrote: On 5/19/21 3:55 PM, Jonathan Wakely wrote: On 19/05/21 13:26 -0400, Jason Merrill wrote: On 5/19/21 12:46 PM, Jonathan Wakely wrote: On 19/05/21 17:39 +0100, Jonathan Wakely wrote: Jakub pointed out I'd

[PATCH] add missing GTY support for hash-map (PR 100463)

2021-05-24 Thread Martin Sebor via Gcc-patches
Instantiating a hash_map on a number of integer types including, for example, int or unsigned int (such as location_t), or HOST_WIDE_INT, and using it with the garbage collector causes many cryptic compilation errors due to incomplete support for such types (the PR shows a few examples). I ran in

Re: [PATCH 1/5] Common API for accessing global and on-demand ranges.

2021-05-24 Thread Martin Sebor via Gcc-patches
On 5/21/21 5:39 AM, Aldy Hernandez via Gcc-patches wrote: This patch provides a generic API for accessing global ranges. It is meant to replace get_range_info() and get_ptr_nonnull() with one common interface. It uses the same API as the ranger (class range_query), so there will now be one API

Re: [PATCH 4/5] Convert remaining passes to RANGE_QUERY.

2021-05-24 Thread Martin Sebor via Gcc-patches
On 5/21/21 5:39 AM, Aldy Hernandez via Gcc-patches wrote: This patch converts the remaining users of get_range_info and get_ptr_nonnull to the range_query API. No effort was made to move passes away from VR_ANTI_RANGE, or any other use of deprecated methods. This was a straight up conversion to

[PATCH 0/11] warning control by group and location (PR 74765)

2021-05-24 Thread Martin Sebor via Gcc-patches
Having just one bit control whether an expression or statement should be allowed to trigger warnings has been a source of bug reports about false negatives for years. PR 74765 has a representative test case that shows how by setting the bit to avoid -Wparentheses the C++ front end also ends up pr

[PATCH 1/11] introduce xxx_no_warning APIs

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch introduces the get_no_warning(), set_no_warning(), and copy_no_warning() APIs without making use of them in the rest of GCC. They are in three files: diagnostic-spec.{h,c}: Location-centric overloads. warning-control.cc: Tree- and gimple*-centric overloads. The location-c

[PATCH 2/11] use xxx_no_warning APIs in Ada

2021-05-24 Thread Martin Sebor via Gcc-patches
[PATCH 2/11] use xxx_no_warning APIs in Ada. Add support for per-location warning groups. gcc/ada/ChangeLog: * gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): Replace TREE_NO_WARNING with set_no_warning. (gnat_gimplify_expr): Same. * gcc-interface/utils.c (gnat_pushdecl): Same

[PATCH 3/11] use xxx_no_warning APIs in C

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the C front end. Add support for per-location warning groups. gcc/c/ChangeLog: * c-decl.c (pop_scope): Replace direct uses of TREE_NO_WARNING with get_no_warning, set_no_warning, and copy_no_warning. (diagnose_mismatched_decls): Same.

[PATCH 4/11] use xxx_no_warning APIs in C family

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the C family common subset of the C and C++ front ends. Add support for per-location warning groups. gcc/c-family/ChangeLog: * c-common.c (c_wrap_maybe_const): Remove TREE_NO_WARNING. (c_common_truthvalue_conversion): Replace direct u

[PATCH 5/11] use xxx_no_warning APIs in C++

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the C++ front end. For the set/get_no_warning calls I tried to find the most appropriate option to disable and query. In some cases there are helpful comments nearby that made this easy. In other cases it was less straightforward, and i

[PATCH 6/11] use xxx_no_warning APIs in Fortran

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the Fortran front end. I don't know the Fortran front end and I made no effort to try to find the right warning options in the calls to set/get_no_warning. Add support for per-location warning groups. gcc/fortran/ChangeLog: * trans-arr

[PATCH 7/11] use xxx_no_warning APIs in Fortran

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the LTO front end. The streaming support doesn't extend to multiple bits yet. I plan to do that in a follow-up change. Add support for per-location warning groups. gcc/lto/ChangeLog: * gimple-streamer-out.c (output_gimple_stmt): Same.

[PATCH 8/11] use xxx_no_warning APIs in Objective-C

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the Objective-C front end. Add support for per-location warning groups. gcc/objc/ChangeLog: * objc-act.c (objc_maybe_build_modify_expr): Replace direct uses of TREE_NO_WARNING with get_no_warning, and set_no_warning. (objc_build_incr_

[PATCH 9/11] use xxx_no_warning APIs in rl78 back end

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in the rl78 back end. Add support for per-location warning groups. gcc/ChangeLog: * config/rl78/rl78.c (rl78_handle_naked_attribute): Replace a direct use of TREE_NO_WARNING with set_no_warning. diff --git a/gcc/config/rl78/rl78.c b/gcc/

[PATCH 10/11] use xxx_no_warning APIs in libcc1

2021-05-24 Thread Martin Sebor via Gcc-patches
The attached patch replaces the uses of TREE_NO_WARNING in libc11. Add support for per-location warning groups. libcc1/ChangeLog: * libcp1plugin.cc (record_decl_address): Replace a direct use of TREE_NO_WARNING with set_no_warning. diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc

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