[pushed] analyzer: respect GCC_COLORS in out-of-bounds diagrams [PR114588]

2024-04-05 Thread David Malcolm
C_COLORS. * text-art/style.cc: Include "diagnostic-color.h". (text_art::get_style_from_color_cap_name): New. * text-art/types.h (get_style_from_color_cap_name): New decl. Signed-off-by: David Malcolm --- gcc/analyzer/access-diagram.cc | 8 ++-- gcc/diagnosti

[pushed] analyzer: add SARIF property bags to -Wanalyzer-overlapping-buffers

2024-04-10 Thread David Malcolm
son): New decl. (symbolic_byte_range::to_json): New decl. Signed-off-by: David Malcolm --- gcc/analyzer/call-details.cc | 33 ++--- gcc/analyzer/ranges.cc | 15 +++ gcc/analyzer/ranges.h| 4 3 files changed, 49 insertions(+), 3 deletions(-)

[pushed] analyzer: add SARIF property bag to -Wanalyzer-infinite-loop

2024-04-10 Thread David Malcolm
t-sarif.h". (infinite_loop::to_json): New. (infinite_loop_diagnostic::maybe_add_sarif_properties): New. Signed-off-by: David Malcolm --- gcc/analyzer/infinite-loop.cc | 22 ++ 1 file changed, 22 insertions(+) diff --git a/gcc/analyzer/infinite-loop.cc b/gcc/ana

[pushed] testsuite: add some missing -fanalyzer to plugin tests

2024-04-10 Thread David Malcolm
NULL derefs. * gcc.dg/plugin/taint-CVE-2011-0521-2.c: Likewise. * gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c: Add missing -fanalyzer to options. * gcc.dg/plugin/taint-CVE-2011-0521-3.c: Likewise. Drop xfail. Signed-off-by: David Malcolm --- gcc/tests

[pushed] analyzer, testuite: comment fixes

2024-04-10 Thread David Malcolm
Successfully regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-9896-g082374f6570a31. gcc/testsuite/ChangeLog: * c-c++-common/analyzer/memset-1.c: Clarify some comments. Signed-off-by: David Malcolm --- gcc/testsuite/c-c++-common/analyzer/memset-1.c | 4 ++-- 1 file changed, 2

[pushed] analyzer: show size in SARIF property bag for -Wanalyzer-tainted-allocation-size

2024-04-10 Thread David Malcolm
Signed-off-by: David Malcolm --- gcc/analyzer/sm-taint.cc | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/sm-taint.cc b/gcc/analyzer/sm-taint.cc index 1d1e208fdf49..a9c6d4db43f4 100644 --- a/gcc/analyzer/sm-taint.cc +++ b/gcc/analyzer/sm-taint.cc @@

[pushed] analyzer: fix ICE on negative values for size_t [PR114472]

2024-04-10 Thread David Malcolm
fset. * store.cc (bit_range::intersects_p): Replace assertion with test. (bit_range::exceeds_p): Likewise. (bit_range::falls_short_of_p): Likewise. gcc/testsuite/ChangeLog: * c-c++-common/analyzer/out-of-bounds-pr114472.c: New test. Signed-off-by: David Malcolm ---

[pushed] analyzer: fixes to internal docs

2024-04-10 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-9897-g7f6599a201be2a. gcc/ChangeLog: * doc/analyzer.texi: Various tweaks. Signed-off-by: David Malcolm --- gcc/doc/analyzer.texi | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-)

[pushed] analyzer: add SARIF property bag to -Wanalyzer-infinite-recursion

2024-04-10 Thread David Malcolm
t-sarif.h". (infinite_recursion_diagnostic::maybe_add_sarif_properties): New. Signed-off-by: David Malcolm --- gcc/analyzer/infinite-recursion.cc | 13 + 1 file changed, 13 insertions(+) diff --git a/gcc/analyzer/infinite-recursion.cc b/gcc/analyzer/infinite-recu

[pushed] analyzer: fix skipping of debug stmts [PR113253]

2024-01-31 Thread David Malcolm
sa_name): Skip any debug stmts in the FOR_EACH_IMM_USE_FAST list. * supergraph.cc (supergraph::supergraph): Don't add debug stmts to the supernodes. gcc/testsuite/ChangeLog: PR analyzer/113253 * gcc.dg/analyzer/deref-before-check-pr113253.c: New test. S

[pushed] diagnostics: unbreak 'make gcc.pot'

2024-02-12 Thread David Malcolm
On Fri, 2024-02-09 at 16:53 +, Joseph Myers wrote: > On Fri, 1 Dec 2023, David Malcolm wrote: > > * diagnostic-core.h (emit_diagnostic_valist): New overload > decl. > > This has broken regeneration of gcc.pot (overloads can't have the > message >

Re: [PATCH] coreutils-sum-pr108666.c: fix spurious LLP64 warnings

2024-02-14 Thread David Malcolm
On Fri, 2024-02-02 at 23:55 +, Jonathan Yong wrote: > Attached patch OK? Fixes the following warnings: Thanks; looks good to me. Dave > coreutils-sum-pr108666.c:17:1: warning: conflicting types for built- > in function ‘memcpy’; expected ‘void *(void *, const void *, long > long unsigned int

Re: [PATCH] analyzer/pr104308.c: Avoid optimizing away the copies

2024-02-14 Thread David Malcolm
On Tue, 2022-05-03 at 17:29 -0700, Palmer Dabbelt wrote: > The test cases in analyzer/pr104308.c use uninitialized values in a > way > that doesn't plumb through to the return value of the function.  This > allows the accesses to be deleted, which can result in the diagnostic > not firing. Thanks;

Re: [PATCH] libgccjit: Clear pending_assemble_externals_processed

2024-02-15 Thread David Malcolm
On Thu, 2024-02-08 at 17:09 -0500, Antoni Boucher wrote: > Hi. > This patch fixes the bug 113842. > I cannot yet add a test with this patch since it requires using > try/catch which is not yet merged in master. > Thanks for the review. Thanks; patch looks good for trunk, assuming you've tested it

Re: [PATCH] libgccjit: Add count zeroes builtins to ensure_optimization_builtins_exist

2024-02-15 Thread David Malcolm
On Thu, 2024-02-15 at 11:32 -0500, Antoni Boucher wrote: > Hi. > This patch adds some missing builtins that can be generated by > optimizations. > I'm not sure how to add a test for this one. > Do you know the C code that can be optimized to a builtin_clz? I don't. Given a reproducer we could pro

Re: [PATCH] libgccjit: Clear pending_assemble_externals_processed

2024-02-15 Thread David Malcolm
Dave > > On Thu, 2024-02-15 at 10:35 -0500, David Malcolm wrote: > > On Thu, 2024-02-08 at 17:09 -0500, Antoni Boucher wrote: > > > Hi. > > > This patch fixes the bug 113842. > > > I cannot yet add a test with this patch since it requires using > > >

[pushed] analyzer: remove offset_region size overloads [PR111266]

2024-02-15 Thread David Malcolm
og: PR analyzer/111266 * c-c++-common/analyzer/out-of-bounds-pr111266.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region.cc| 48 --- gcc/analyzer/region.h | 20 .../analyzer/out-of-bounds-pr111266.

[pushed] analyzer, testsuite: add regression test [PR110520]

2024-02-19 Thread David Malcolm
Tested on x86_64-pc-linux-gnu. Pushed to trunk as r14-9075-geb37ea529745c3. gcc/testsuite/ChangeLog: PR analyzer/110520 * c-c++-common/analyzer/null-deref-pr110520.c: New test. Signed-off-by: David Malcolm --- gcc/testsuite/c-c++-common/analyzer/null-deref-pr110520.c | 8

[pushed] analyzer: fix -Wanalyzer-va-arg-type-mismatch false +ve on int types [PR111289]

2024-02-19 Thread David Malcolm
t. * c-c++-common/analyzer/stdarg-pr111289-ptr.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/varargs.cc | 38 -- .../analyzer/stdarg-pr111289-int.c| 69 +++ .../analyzer/stdarg-pr111289-ptr.c| 39 ++

Re: [PATCH] libgccjit: Add option to allow special characters in function names

2024-02-20 Thread David Malcolm
On Thu, 2024-02-15 at 17:08 -0500, Antoni Boucher wrote: > Hi. > This patch adds a new option to allow special characters like . and $ > in function names. > This is useful to allow for mangling using those characters. > Thanks for the review. Thanks for the patch. > diff --git a/gcc/jit/docs/top

[pushed] analyzer: handle empty ranges in symbolic_byte_range::intersection [PR113998]

2024-02-20 Thread David Malcolm
mpty ranges. (selftest::test_intersects): Add test coverage for empty ranges. gcc/testsuite/ChangeLog: PR analyzer/113998 * c-c++-common/analyzer/overlapping-buffers-pr113998.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/ranges.cc

[pushed] analyzer: handle array-initialization from a string_cst [PR113999]

2024-02-20 Thread David Malcolm
uite/ChangeLog: PR analyzer/113999 * c-c++-common/analyzer/strlen-pr113999.c: New test. * gcc.dg/analyzer/strlen-1.c: More test coverage. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h | 3 ++ gcc/analyzer/region-model-manager.cc

[pushed] analyzer: fix ICE on floating-point bounds [PR111881]

2024-02-27 Thread David Malcolm
that m_constant has integral type. (range::add_bound): Bail out on floating point constants. gcc/testsuite/ChangeLog: PR analyzer/111881 * c-c++-common/analyzer/conditionals-pr111881.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/constraint-manage

[pushed] analyzer: use correct format code for string literal indices [PR110483, PR111802]

2024-02-27 Thread David Malcolm
-9199-g939439a90f234f. gcc/analyzer/ChangeLog: PR analyzer/110483 PR analyzer/111802 * access-diagram.cc (string_literal_spatial_item::add_column_for_byte): Use %wu for printing unsigned HOST_WIDE_INT. Signed-off-by: David Malcolm --- gcc/analyzer/access-

Re: [PATCH] developer option: -fdump-generic-nodes; initial incorporation

2024-02-28 Thread David Malcolm
On Wed, 2024-02-28 at 08:58 +0100, Richard Biener wrote: > On Tue, Feb 27, 2024 at 10:20 PM Robert Dubner > wrote: > > > > Richard, > > > > Thank you very much for your comments. > > > > When I set out to create the capability, I had a "specification" in > > mind. > > > > I didn't have a clue

[pushed 1/3] pretty-print: add selftest coverage for numbered args

2024-01-10 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-7104-g7daa935c7997f3. gcc/ChangeLog: * pretty-print.cc (selftest::test_pp_format): Add selftest coverage for numbered args. Signed-off-by: David Malcolm ---

[pushed 3/3] gcc-urlifier: handle option prefixes such as '-fno-'

2024-01-10 Thread David Malcolm
Handle prefix mappings before calling find_opt. (selftest::gcc_urlifier_cc_tests): Add example of urlifying a "-fno-"-prefixed command-line option. * opts-common.cc (get_option_prefix_remapping): New. * opts.h (get_option_prefi

[pushed 2/3] pretty-print: support urlification in phase 3

2024-01-10 Thread David Malcolm
(selftest::pp_printf_with_urlifier): Pass urlifier to pp_output_formatted_text. (selftest::test_urlification): Update results for the existing case of quoted text stradding chunks; add more such test cases. * pretty-print.h (class quoting_info): New forward dec

Re: [PATCH] libgccjit: Fix ira cost segfault

2024-01-10 Thread David Malcolm
On Thu, 2023-11-16 at 17:28 -0500, Antoni Boucher wrote: > Hi. > This patch fixes a segfault that happens when compiling librsvg (more > specifically its dependency aho-corasick) with rustc_codegen_gcc (bug > 112575). > I was not able to create a reproducer for this bug: I'm assuming I > might need

Re: [PATCH] libgccjit: Fix ira cost segfault

2024-01-10 Thread David Malcolm
On Wed, 2024-01-10 at 09:30 -0500, David Malcolm wrote: > On Thu, 2023-11-16 at 17:28 -0500, Antoni Boucher wrote: > > Hi. > > This patch fixes a segfault that happens when compiling librsvg > > (more > > specifically its dependency aho-corasick) with rustc_codegen_gcc

Re: [PATCH] libgccjit Fix a RTL bug for libgccjit

2024-01-10 Thread David Malcolm
On Mon, 2023-12-11 at 09:06 -0700, Jeff Law wrote: > > > On 11/20/23 16:54, David Malcolm wrote: > > On Mon, 2023-11-20 at 16:38 -0700, Jeff Law wrote: > > > > > > > > > On 11/20/23 15:46, David Malcolm wrote: > > >

Re: [PATCH] libgccjit: Fix GGC segfault when using -flto

2024-01-10 Thread David Malcolm
ttps://gcc.gnu.org/pipermail/gcc-patches/2023-November/638841.html right? Dave > > On Fri, 2023-12-01 at 12:49 -0500, David Malcolm wrote: > > On Thu, 2023-11-30 at 17:13 -0500, Antoni Boucher wrote: > > > Here's the updated patch. > > > The failure was due t

Re: [PATCH] libgccjit: Fix GGC segfault when using -flto

2024-01-10 Thread David Malcolm
On Wed, 2024-01-10 at 10:27 -0500, Antoni Boucher wrote: > On Wed, 2024-01-10 at 10:19 -0500, David Malcolm wrote: > > On Mon, 2023-12-11 at 19:20 -0500, Antoni Boucher wrote: > > > I'm not sure how to do this. I tried the following commands, but > > >

Re: [PATCH] libgccjit: Add missing builtins needed by optimizations

2024-01-10 Thread David Malcolm
the status in patchwork is purely to help keep track of patch reviews; whether or not a patch is suitable to push at a given time is probably on a case-by-case basis (the key question being "how likely is merging the patch going to cause problems") Dave > > On Tue, 2024-01-09 at 11

Re: [PATCH] libgccjit: Implement sizeof operator

2024-01-10 Thread David Malcolm
On Wed, 2024-01-10 at 17:38 -0500, Antoni Boucher wrote: > On Tue, 2024-01-09 at 11:33 -0500, David Malcolm wrote: > > On Fri, 2023-12-22 at 10:25 -0500, Antoni Boucher wrote: > > > Hi. > > > This patch adds the support of the sizeof operator. > > > I was

Re: [PATCH] libgccjit: Add support for machine-dependent builtins

2024-01-10 Thread David Malcolm
On Wed, 2024-01-10 at 18:29 -0500, Antoni Boucher wrote: > David: Ping in case you missed this patch. For some reason it's not showing up in patchwork (or, at least, I can't find it there). Do you have a URL for it there? Sorry about this Dave > > On Sat, 2023-02-11 at 17:37 -0800, Andrew Pins

Re: [PATCH] Add support for function attributes and variable attributes

2024-01-11 Thread David Malcolm
On Thu, 2024-01-11 at 01:00 +0100, Guillaume Gomez wrote: > Hi David. > > Thanks for the review! > > > > +.. function::  void\ > > > +   gcc_jit_lvalue_add_string_attribute > > > (gcc_jit_lvalue *variable, > > > +    enum > > > gcc_jit_f

Re: [PATCH] Add support for function attributes and variable attributes

2024-01-11 Thread David Malcolm
vered > that we could just add a call to `asm` to prevent this from happening > so I > added it. > > So yes, all jit tests are passing as expected. :) Good. It sounds like the patch you have locally is ready, but it has some nontrivial changes compared to the last version you posted

[pushed] analyzer: casting all zeroes should give all zeroes [PR113333]

2024-01-15 Thread David Malcolm
c-c++-common/analyzer/pr96639.c: Update expected results. * gcc.dg/analyzer/data-model-9.c: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.cc | 6 .../c-c++-common/analyzer/calloc-1.c | 34 +++ gcc/testsuite/c-c++-common/anal

[pushed] analyzer: fix false +ves from -Wanalyzer-tainted-array-index with unsigned char index [PR106229]

2024-01-15 Thread David Malcolm
-Wanalyzer-tainted-array-index if the type of the value makes it impossible for it to be out-of-bounds of the array. gcc/testsuite/ChangeLog: PR analyzer/106229 * c-c++-common/analyzer/taint-index-pr106229.c: New test. Signed-off-by: David Malcolm --- gcc/analy

Re: [PATCH] testsuite, jit, Darwin: Add libSystem to a test.

2024-01-16 Thread David Malcolm
On Tue, 2024-01-16 at 11:13 +, Iain Sandoe wrote: > tested on x86_64, i686 Darwin, x86_64 Linux, > OK for trunk ? When ? Thanks. LGTM for trunk; given that the impact is limited to just a jit testcase I think this can go in now. Dave > thanks > Iain > > --- 8< --- > > test-ggc-bugfix.c f

Re: [PATCH 1/4] testsuite, jit: test-alias-attribute.c requires alias support.

2024-01-16 Thread David Malcolm
On Sat, 2024-01-13 at 13:57 +, Iain Sandoe wrote: > Add a dg-require-alias to cover this. Sorry about the breakage; LGTM for trunk. Thanks Dave > > gcc/testsuite/ChangeLog: > > * jit.dg/test-alias-attribute.c: Require target alias > support. > > Signed-off-by: Iain Sandoe

Re: [PATCH 2/4] testsuite, jit: Handle whitespace in test-link-section-assembler.c.

2024-01-16 Thread David Malcolm
On Sat, 2024-01-13 at 13:57 +, Iain Sandoe wrote: > Darwin has a different .section directive that has more fields and > uses different whitespace.  Amend the whitespace in the scan-asm to > be more flexible. LGTM for trunk, assuming your testing was successful. Thanks Dave > > gcc/testsuit

Re: [PATCH 3/4] testsuite, jit: Allow for target-specific assembler scans.

2024-01-16 Thread David Malcolm
On Sat, 2024-01-13 at 13:57 +, Iain Sandoe wrote: > If we want to support multiple object formats and to allow for > scan-assembler tests, we need to make it possible to adjust the > tests on a per-target basis. > > This adds similar mechamisms to jit-verify-assembler-output{,-not} > to those

Re: [PATCH 4/4] testsuite,jit: Handle Darwin/Mach-O in assembler tests.

2024-01-16 Thread David Malcolm
On Sat, 2024-01-13 at 13:57 +, Iain Sandoe wrote: > Several of the jit tests check for assembler-specific output > which differs on Mach-O from ELF. > > This patch uses the facility to make the scans targer-dependent > and adds handling for darwin. Sorry about the issues with the tests. Than

[pushed] analyzer: fix offsets in has_null_terminator [PR112811]

2024-01-18 Thread David Malcolm
ator. * region-model.h (region_model::scan_for_null_terminator_1): New decl. gcc/testsuite/ChangeLog: PR analyzer/112811 * c-c++-common/analyzer/strlen-pr112811.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.cc | 431 --

[pushed] analyzer: fix ICE on strlen ((char *)&VECTOR_CST) [PR111361]

2024-01-18 Thread David Malcolm
* c-c++-common/analyzer/strncpy-1.c (test_zero_fill): Remove fixed xfail. * c-c++-common/analyzer/strncpy-pr111361.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.cc | 9 - .../c-c++-common/analyzer/strlen-pr111361.

[pushed] Fix ICE in -fdiagnostics-generate-patch [PR112684]

2024-01-18 Thread David Malcolm
t context will have been created. Signed-off-by: David Malcolm --- gcc/toplev.cc | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 55636ff6e80..175d4cd18fa 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -2323,11 +2323,8 @@ toplev::main

Re: [PATCH] libgccjit: Add support for creating temporary variables

2024-01-24 Thread David Malcolm
On Fri, 2024-01-19 at 16:54 -0500, Antoni Boucher wrote: > Hi. > This patch adds a new way to create local variable that won't > generate > debug info: it is to be used for compiler-generated variables. > Thanks for the review. Thanks for the patch. > diff --git a/gcc/jit/docs/topics/compatibilit

Re: [PATCH] libgccjit: Add gcc_jit_global_set_readonly

2024-01-24 Thread David Malcolm
On Fri, 2024-01-19 at 16:57 -0500, Antoni Boucher wrote: > Hi. > This patch adds a new API gcc_jit_global_set_readonly: it's > equivalent > to having a const global variable, but it is useful in the case of > complex compilers where it is not convenient to use const. > Thanks for the review. Hi An

[pushed] analyzer kernel plugin: implement __check_object_size [PR112927]

2024-01-24 Thread David Malcolm
lugin.exp: Add taint-pr112927.c. * gcc.dg/plugin/taint-pr112927.c: New test. Signed-off-by: David Malcolm --- .../gcc.dg/plugin/analyzer_kernel_plugin.c| 18 +++ gcc/testsuite/gcc.dg/plugin/plugin.exp| 3 +- gcc/testsuite/gcc.dg/plugin/taint-pr112927.c | 49 +++

[pushed] analyzer: fix taint false +ve due to overzealous state purging [PR112977]

2024-01-24 Thread David Malcolm
s_lb" and "has_ub". * sm.h (state_machine::has_alt_get_inherited_state_p): New vfunc. gcc/testsuite/ChangeLog: PR analyzer/112977 * gcc.dg/plugin/plugin.exp: Add taint-pr112977.c. * gcc.dg/plugin/taint-pr112977.c: New test. Signed-off-by:

Re: [PATCH] libgccjit: Allow comparing array types

2024-01-24 Thread David Malcolm
On Fri, 2024-01-19 at 16:55 -0500, Antoni Boucher wrote: > Hi. > This patch allows comparing different instances of array types as > equal. > Thanks for the review. Thanks; the patch looks good to me. Dave

Re: [PATCH] libgccjit: Allow comparing aligned int types

2024-01-24 Thread David Malcolm
On Thu, 2023-12-21 at 08:33 -0500, Antoni Boucher wrote: > Hi. > This patch allows comparing aligned integer types as equal. > There's a TODO in the code about whether we should check that the > alignment is equal. > What are your thoughts on this? I think we should check for equal alignment. [..

Re: [PATCH] libgccjit: Add convert vector

2024-01-24 Thread David Malcolm
On Thu, 2023-12-21 at 16:01 -0500, Antoni Boucher wrote: > Hi. > This patch adds the support for the convert vector internal function. Thanks for the patch. > I'll need to double-check that making the decl a register is > necessary. I confess I don't know anything about this aspect of the patch,

Re: [PATCH] libgccjit: Fix float playback for cross-compilation

2024-01-24 Thread David Malcolm
On Thu, 2024-01-11 at 18:42 -0500, Antoni Boucher wrote: > Hi. > This patch fixes the bug 113343. > I'm wondering if there's a better solution than using mpfr. > The only other solution I found is real_from_string, but that seems > overkill to convert the number to a string. > I could not find a be

Re: [PATCH] jit, Darwin: Implement library exports list.

2024-01-24 Thread David Malcolm
On Tue, 2024-01-16 at 11:10 +, Iain Sandoe wrote: > Tested on x86_64, i686 Darwin and x86_64 Linux, > OK for trunk? when ? > thanks, > Iain Hi Iain, thanks for the patch. I'll have to defer to your Darwin expertise here; given that you've tested it on the above configurations I'll assume it's

Re: [PATCH] testsuite, jit: Stabilize error output.

2024-01-24 Thread David Malcolm
On Tue, 2024-01-16 at 11:12 +, Iain Sandoe wrote: > Tested on x86_64, i686 Darwin, x86_64 Linux, > OK for trunk? When? > thanks > Iain Thanks; looks good to me for trunk. Given that the scope is just the jit testsuite and that you've tested it on 3 configurations (and presumably made use of t

[pushed] analyzer: fix defaults in compound assignments from non-zero offsets [PR112969]

2024-01-25 Thread David Malcolm
-off-by: David Malcolm --- gcc/analyzer/store.cc | 11 +++- .../analyzer/compound-assignment-5.c | 3 +- .../analyzer/compound-assignment-pr112969.c | 35 + .../gcc.dg/plugin/infoleak-pr112969.c | 52 +++ gcc/testsuite/gc

[pushed] analyzer: add SARIF property bag to -Wanalyzer-allocation-size

2024-01-30 Thread David Malcolm
city svalue to dubious_allocation_size ctor. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.cc | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index dbb2149dbd46..ba82f46c1887 10

[pushed] analyzer: fix -Wanalyzer-allocation-size false +ve on Linux kernel's round_up macro [PR113654]

2024-01-30 Thread David Malcolm
le_p): New. (is_dubious_capacity): New. (region_model::check_region_size): Move usage of size_visitor into is_dubious_capacity. gcc/testsuite/ChangeLog: PR analyzer/113654 * c-c++-common/analyzer/allocation-size-pr113654-1.c: New test. Signed-off-by: D

[pushed] analyzer: handle null "var" in state_change_event::get_desc [PR113509]

2024-01-30 Thread David Malcolm
yzer/113509 * checker-event.cc (state_change_event::get_desc): Don't assume "var" is non-NULL. gcc/testsuite/ChangeLog: PR analyzer/113509 * c-c++-common/analyzer/stdarg-pr113509.c: New test. Signed-off-by: David Malcolm --- gcc/analyz

[pushed] analyzer: cleanups [PR112655]

2023-12-14 Thread David Malcolm
Avoid copying eedges in infinite_loop::infinite_loop. Use initializer lists in the various places reported in PR analyzer/112655 (apart from coord_test's ctor, which would require nontrivial refactoring). Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-6549-g

[PATCH 0/4] v3 of: Option handling: add documentation URLs

2023-12-14 Thread David Malcolm
> Hi David, > > On Fri, Dec 08, 2023 at 06:35:56PM -0500, David Malcolm wrote: > > On Tue, 2023-11-21 at 23:43 +, Joseph Myers wrote: > > > On Tue, 21 Nov 2023, Tobias Burnus wrote: > > > > > > > On 21.11.23 14:57, David Malcolm wrote: > >

[PATCH 3/4; v2] opts: add logic to generate options-urls.cc

2023-12-14 Thread David Malcolm
le target. * opt-functions.awk (url_suffix): New function. (lang_url_suffix): New function. * options-urls-cc-gen.awk: New file. * opts.h (get_opt_url_suffix): New decl. Signed-off-by: David Malcolm --- gcc/Makefile.in | 18 +-- gcc/opt-functions.awk

[PATCH 4/4; v2] options: wire up options-urls.cc into gcc_urlifier

2023-12-14 Thread David Malcolm
naming. * opts.h: Include "rich-location.h". (get_option_url_suffix): New decl. gcc/testsuite/ChangeLog: * lib/gcc-dg.exp: Set TERM to xterm. gcc/ChangeLog: * toplev.cc (general_init): Pass lang_mask to urlifier. Signed-off-by: David Malcolm ---

[PATCH 1/4; v3] options: add gcc/regenerate-opt-urls.py

2023-12-14 Thread David Malcolm
description of regenerate-opt-urls.py. Add LangUrlSuffix_*. * doc/sourcebuild.texi (Anatomy of a Target Back End): Add reference to regenerate-opt-urls.py's TARGET_SPECIFIC_PAGES. * regenerate-opt-urls.py: New file. Signed-off-by: David Malcolm --- gcc/Makefi

[pushed] testsuite: move more analyzer test cases to c-c++-common (3) [PR96395]

2023-12-14 Thread David Malcolm
* c-c++-common/analyzer/zlib-5.c: ...here. Signed-off-by: David Malcolm --- gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/20020129-1.c | 0 .../analyzer/SARD-tc117-basic-1-min.c| 0 .../analyzer/SARD-tc249-basic-00034-min.c| 0 gcc/te

[pushed] analyzer: use bit-level granularity for concrete bounds-checking [PR112792]

2023-12-16 Thread David Malcolm
* store.h (bit_range::intersects_p): New overload. (bit_range::exceeds_p): New. (bit_range::falls_short_of_p): New. (byte_range::intersects_p): Delete. (byte_range::exceeds_p): Delete. (byte_range::falls_short_of_p): Delete. gcc/testsuite/ChangeLog:

[pushed] json: fix escaping of object keys

2023-12-16 Thread David Malcolm
ject::print): Use it for printing keys. (string::print): Move implementation to print_escaped_json_string. (selftest::test_writing_objects): Add a key containing quote, backslash, and control characters. Signed-off-by: David Malcolm --- gcc/json.cc

[pushed] analyzer: add sarif properties for bounds checking diagnostics

2023-12-16 Thread David Malcolm
(byte_range::to_json): New decl. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.cc| 59 + gcc/analyzer/analyzer.h | 12 +++ gcc/analyzer/bounds-checking.cc | 58 gcc/analyzer/region-model.cc

[PATCH 1/4; v4] options: add gcc/regenerate-opt-urls.py

2024-01-02 Thread David Malcolm
On Wed, 2023-12-20 at 00:24 +, Joseph Myers wrote: Thanks for the review. > On Thu, 14 Dec 2023, David Malcolm wrote: > > > diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi > > index 26a7e9c35070..9a394b3e2c77 100644 > > --- a/gcc/doc/sourcebuil

[pushed] analyzer: handle arrays of unknown size in access diagrams [PR113222]

2024-01-04 Thread David Malcolm
item::add_boundaries): Handle TYPE_DOMAIN being null. (valid_region_spatial_item::add_array_elements_to_table): Likewise. gcc/testsuite/ChangeLog: PR analyzer/113222 * gcc.dg/analyzer/out-of-bounds-diagram-pr113222.c: New test. Signed-off-by: David Malcolm --- gcc/anal

[pushed] analyzer: fix deref-before-check false positives due to inlining [PR112790]

2024-01-04 Thread David Malcolm
* c-c++-common/analyzer/deref-before-check-pr112790.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/checker-event.cc | 40 --- gcc/analyzer/inlining-iterator.h | 40 +++ gcc/analyzer/sm-malloc.cc

[pushed] analyzer: add sarif properties for checker events

2024-01-04 Thread David Malcolm
bject): New forward decl. (diagnostic_event::maybe_add_sarif_properties): New vfunc. Signed-off-by: David Malcolm --- gcc/analyzer/checker-event.cc | 43 ++ gcc/analyzer/checker-event.h | 6 + gcc/diagnostic-format-sarif.cc | 13 +- gcc/diagnostic-format

Re: [PATCH 1/4; v4] options: add gcc/regenerate-opt-urls.py

2024-01-04 Thread David Malcolm
On Wed, 2024-01-03 at 00:41 +, Joseph Myers wrote: > On Tue, 2 Jan 2024, David Malcolm wrote: > > > > > +    #print(f'{url_suffix=} {index_text=}') > > > > > > Various commented-out or "if 0" debugging code like this should > >

CI for "Option handling: add documentation URLs"

2024-01-04 Thread David Malcolm
On Fri, 2023-12-15 at 01:59 +0100, Mark Wielaard wrote: > Hi David, > > On Thu, Dec 14, 2023 at 10:01:39AM -0500, David Malcolm wrote: > > > Once your patch is in please feel free to sent an email to > > > build...@sourceware.org > > > https://sourceware.org

Re: [PATCH] libgccjit: Add support for setting the comment ident

2024-01-05 Thread David Malcolm
On Fri, 2024-01-05 at 12:09 -0500, Antoni Boucher wrote: > Hi. > This patch adds support for setting the comment ident (analogous to > #ident "comment" in C). > Thanks for the review. Thanks for the patch. This may sound like a silly question, but what does #ident do and what is it used for? FWI

Re: [PATCH] libgccjit: Support signed char flag

2024-01-09 Thread David Malcolm
On Thu, 2023-12-21 at 08:42 -0500, Antoni Boucher wrote: > Hi. > This patch adds support for the -fsigned-char flag. Thanks. The patch looks correct to me. > I'm not sure how to test it since I stumbled upon this bug when I > found > this other bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1

Re: [PATCH] libgccjit: Implement sizeof operator

2024-01-09 Thread David Malcolm
On Fri, 2023-12-22 at 10:25 -0500, Antoni Boucher wrote: > Hi. > This patch adds the support of the sizeof operator. > I was wondering if this new API entrypoint should take a location as > a > parameter. What do you think? I'd prefer it if it did (even if it's currently ignored internally), but i

Re: [PATCH] libgccjit: Add missing builtins needed by optimizations

2024-01-09 Thread David Malcolm
On Fri, 2023-12-22 at 09:39 -0500, Antoni Boucher wrote: > Hi. > This patch adds missing builtins needed by optimizations. > Thanks for the review. The patch looks good to me. Thanks! Dave

Re: [PATCH] Add support for function attributes and variable attributes

2024-01-09 Thread David Malcolm
On Wed, 2023-11-15 at 17:53 +0100, Guillaume Gomez wrote: > Hi, > > This patch adds the (incomplete) support for function and variable > attributes. The added attributes are the ones we're using in > rustc_codegen_gcc but all the groundwork is done to add more (and we > will very likely add more a

[pushed] docs: remove stray reference to -fanalyzer-checker=taint [PR103533]

2023-12-01 Thread David Malcolm
I missed this one in r14-5464-gcfaaa8b11b8429. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-6056-g83b210d55b2846. gcc/ChangeLog: PR analyzer/103533 * doc/extend.texi: Remove stray reference to -fanalyzer-checker=taint. --- gcc/doc/

[pushed] diagnostics, analyzer: add optional per-diagnostic property bags to SARIF

2023-12-01 Thread David Malcolm
I've found it useful in debugging the analyzer for the SARIF output to contain extra analyzer-specific data in each diagnostic. This patch: * adds a way for a diagnostic_metadata to populate a property bag within a SARIF "result" object based on a new vfunc * reworks how diagnostics are emitted wi

Re: [PATCH] libgccjit: Add support for the type bfloat16

2023-12-01 Thread David Malcolm
On Thu, 2023-11-16 at 17:20 -0500, Antoni Boucher wrote: > I forgot to attach the patch. > > On Thu, 2023-11-16 at 17:19 -0500, Antoni Boucher wrote: > > Hi. > > This patch adds the support for the type bfloat16 (bug 112574). > > > > This was asked to be splitted from a another patch sent here: >

Re: [PATCH] libgccjit: Fix GGC segfault when using -flto

2023-12-01 Thread David Malcolm
On Thu, 2023-11-30 at 17:13 -0500, Antoni Boucher wrote: > Here's the updated patch. > The failure was due to the test being in the test array while it > should > not have been there since it changes the context. Thanks for the updated patch. Did you do a full bootstrap and regression test with t

Re: [PATCH] gcc/doc: spelling mistakes and example

2023-12-03 Thread David Malcolm
On Sun, 2023-12-03 at 11:59 +, Jonny Grant wrote: > > > On 03/12/2023 04:03, Xi Ruoyao wrote: > > On Sun, 2023-12-03 at 00:17 +, Jonny Grant wrote: > > > @@ -733,7 +733,7 @@ To configure GCC: > > >  @smallexample > > >  % mkdir @var{objdir} > > >  % cd @var{objdir} > > > -% @var{srcdir}/c

[pushed] diagnostics: use const and references for diagnostic_info

2023-12-06 Thread David Malcolm
mns): Likewise. libcc1/ChangeLog: * context.cc (plugin_print_error_function): Make diagnostic_info param const. Signed-off-by: David Malcolm --- gcc/c-family/c-opts.cc| 2 +- gcc/cp/cp-tree.h | 2 +- g

[pushed] v2: diagnostics: prettify JSON output formats

2023-12-06 Thread David Malcolm
I messed up the testing of the previous version of this patch, and it turned out to have regressions. Whilst fixing them, it turned out I needed a way to disable the formatting for some test cases, so this version of the patch restricts the formatting to just the diagnostics format, and adds a -fn

Re: [PATCH] analyzer: deal with -fshort-enums

2023-12-06 Thread David Malcolm
On Wed, 2023-12-06 at 02:31 -0300, Alexandre Oliva wrote: > On Nov 22, 2023, Alexandre Oliva wrote: > > > Ah, nice, that's a great idea, I wish I'd thought of that!  Will > > do. > > Sorry it took me so long, here it is.  I added two tests, so that, > regardless of the defaults, we get both circ

[pushed] analyzer: fix taint false positives with UNKNOWN [PR112850]

2023-12-06 Thread David Malcolm
PR analyzer/112850 reports a false positive from -Wanalyzer-tainted-allocation-size on the Linux kernel [1] where -fanalyzer complains that an allocation size is attacker-controlled despite the value being correctly sanitized against upper and lower limits. The root cause is that the expression is

[pushed] analyzer: fix ICE for 2 bits before the start of base region [PR112889]

2023-12-07 Thread David Malcolm
Cncrete bindings were using -1 and -2 in the offset field to signify deleted and empty hash slots, but these are valid values, leading to assertion failures inside hash_map::put on a debug build, and probable bugs in a release build. (gdb) call k.dump(true) start: -2, size: 1, next: -1 (gdb) p k.

Re: [PATCH] libgccjit: Fix get_size of size_t

2023-12-07 Thread David Malcolm
On Thu, 2023-12-07 at 17:26 -0500, Antoni Boucher wrote: > Hi. > This patch fixes getting the size of size_t (bug 112910). > > There's one issue with this patch: like every other feature that > checks > for target-specific stuff, it requires a compilation before actually > fetching the size of the

Re: [PATCH] libgccjit: Make new_array_type take unsigned long

2023-12-07 Thread David Malcolm
On Thu, 2023-12-07 at 17:29 -0500, Antoni Boucher wrote: > Hi. > This patches update gcc_jit_context_new_array_type to take the size > as > an unsigned long instead of a int, to allow creating bigger array > types. > > I haven't written the ChangeLog yet because I wasn't sure it's > allowed > to c

Re: [PATCH] libgccjit: Make is_int return false on vector types

2023-12-07 Thread David Malcolm
On Thu, 2023-12-07 at 17:32 -0500, Antoni Boucher wrote: > Hi. > This patch changes the function is_int to return false on vector > types. > Thanks for the review. Thanks; looks good to me Dave

Re: [PATCH] libgccjit: Add type checks in gcc_jit_block_add_assignment_op

2023-12-07 Thread David Malcolm
On Thu, 2023-12-07 at 17:34 -0500, Antoni Boucher wrote: > Hi. > This patch adds checks gcc_jit_block_add_assignment_op to make sure > it > is only ever called on numeric types. > > With the previous patch, this might require a change to also allow > vector types here. > > Thanks for the review.

Re: [PATCH] libgccjit: Make is_int return false on vector types

2023-12-08 Thread David Malcolm
On Thu, 2023-12-07 at 20:09 -0500, Antoni Boucher wrote: > Can I merge this on master even though we're not in phase 1 anymore? Yes, assuming it passes the regression testsuite. > > On Thu, 2023-12-07 at 20:07 -0500, David Malcolm wrote: > > On Thu, 2023-12-07 at 17:32 -

[pushed] analyzer: fix ICE on infoleak with poisoned size

2023-12-08 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-6348-g08262e78209ed4. gcc/analyzer/ChangeLog: * region-model.cc (contains_uninit_p): Only check for svalues that the infoleak warning can handle. gcc/testsuite/ChangeLog: * gcc.dg/plugin/

[pushed] analyzer: avoid taint for (TAINTED % NON_TAINTED)

2023-12-08 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-6349-g0bef72539e585d. gcc/analyzer/ChangeLog: * sm-taint.cc (taint_state_machine::alt_get_inherited_state): Fix handling of TRUNC_MOD_EXPR. gcc/testsuite/ChangeLog: * c-c++-common/analyze

Re: [PATCH 0/4] v2 of Option handling: add documentation URLs

2023-12-08 Thread David Malcolm
On Tue, 2023-11-21 at 23:43 +, Joseph Myers wrote: > On Tue, 21 Nov 2023, Tobias Burnus wrote: > > > On 21.11.23 14:57, David Malcolm wrote: > > > On Tue, 2023-11-21 at 02:09 +0100, Hans-Peter Nilsson wrote: > > > > Sorry for barging in though I did try findin

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