Re: [PATCH 05/45] Add pp_write_text_as_html_like_dot_to_stream

2019-12-16 Thread David Malcolm
On Fri, 2019-12-13 at 13:10 -0500, David Malcolm wrote: > gcc/ChangeLog: > * pretty-print.c (pp_write_text_as_html_like_dot_to_stream): > New > function. > * pretty-print.h (pp_write_text_as_html_like_dot_to_stream): > New decl. > --- >

[PATCH 2/4] analyzer: better logging for dedupe_winners::add

2019-12-17 Thread David Malcolm
gcc/analyzer/ChangeLog: * diagnostic-manager.cc (dedupe_winners::add): Add logging of deduplication decisions made. --- gcc/analyzer/diagnostic-manager.cc | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/analyzer/diagnostic-manager.cc

[PATCH 1/4] analyzer: add ChangeLog

2019-12-17 Thread David Malcolm
--- /dev/null +++ b/gcc/analyzer/ChangeLog @@ -0,0 +1,10 @@ +2019-12-13 David Malcolm + + * Initial creation + + +Copyright (C) 2019 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the

[PATCH 3/4] analyzer: fix dedupe issue seen with CVE-2005-1689

2019-12-17 Thread David Malcolm
Whilst analyzing the reproducer for detecting CVE-2005-1689 (krb5-1.4.1's src/lib/krb5/krb/recvauth.c), the analyzer reported 11 double-free diagnostics on lines of the form: krb5_xfree(inbuf.data); with no deduplication occcurring. The root cause is that the diagnostics each have a COMPONENT

[PATCH 4/4] analyzer: purge state for unknown function calls

2019-12-17 Thread David Malcolm
Whilst analyzing the reproducer for detecting CVE-2005-1689 (krb5-1.4.1's src/lib/krb5/krb/recvauth.c), the analyzer reports a false double-free of the form: krb5_xfree(inbuf.data); krb5_read_message(..., &inbuf); krb5_xfree(inbuf.data); /* false diagnostic here. */ where the call to krb5_

[PATCH 0/4] analyzer: Fixes for problems seen with CVE-2005-1689

2019-12-17 Thread David Malcolm
apped & regrtested on x86_64-pc-linux-gnu. I've pushed these patches to dmalcolm/analyzer on the GCC git mirror. David Malcolm (4): analyzer: add ChangeLog analyzer: better logging for dedupe_winners::add analyzer: fix dedupe issue seen with CVE-2005-1689 analyzer: purge state for unknown

[PATCH] analyzer: remove __analyzer builtins

2019-12-18 Thread David Malcolm
On Fri, 2019-12-13 at 13:31 -0500, David Malcolm wrote: > On Fri, 2019-12-13 at 19:27 +0100, Jakub Jelinek wrote: > > On Fri, Dec 13, 2019 at 01:11:05PM -0500, David Malcolm wrote: > > > gcc/ChangeLog: > > > * builtins.def (BUILT_IN_ANALYZER_BREAK): New builtin. >

Re: [PATCH 05/49] vec.h: add auto_delete_vec

2019-12-18 Thread David Malcolm
On Wed, 2019-12-04 at 09:29 -0700, Martin Sebor wrote: > On 11/15/19 6:22 PM, David Malcolm wrote: > > This patch adds a class auto_delete_vec, a subclass of auto_vec > > > > that deletes all of its elements on destruction; it's used in many > > places later in t

[committed] Drop unused member from cpp_string_location_reader (PR preprocessor/92982)

2019-12-18 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Committed to trunk as r279541. libcpp/ChangeLog: PR preprocessor/92982 * charset.c (cpp_string_location_reader::cpp_string_location_reader): Delete initialization of m_line_table. * include/cppli

[committed] Add diagnostic_metadata and CWE support

2019-12-18 Thread David Malcolm
--git a/gcc/diagnostic-metadata.h b/gcc/diagnostic-metadata.h new file mode 100644 index 000..a759d44fa44 --- /dev/null +++ b/gcc/diagnostic-metadata.h @@ -0,0 +1,42 @@ +/* Additional metadata for a diagnostic. + Copyright (C) 2019 Free Software Foundation, Inc. + Contributed by David Malcolm

Re: [PATCH 12/49] Add diagnostic paths

2019-12-18 Thread David Malcolm
On Sat, 2019-12-07 at 07:45 -0700, Jeff Law wrote: > On Fri, 2019-11-15 at 20:22 -0500, David Malcolm wrote: > > This patch adds support for associating a "diagnostic_path" with a > > diagnostic: a sequence of events predicted by the compiler that > > leads > &g

Re: [PATCH 20/49] analyzer: new builtins

2019-12-19 Thread David Malcolm
On Wed, 2019-12-04 at 11:11 -0700, Martin Sebor wrote: > On 11/15/19 6:23 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * builtins.def (BUILT_IN_ANALYZER_BREAK): New builtin. > > (BUILT_IN_ANALYZER_DUMP): New builtin. > > (BUILT_IN_ANALYZER_DUMP_E

[PATCH] Add --with-diagnostics-urls configuration option and GCC_URLS env var

2019-12-19 Thread David Malcolm
s. That version includes r279073: 2019-12-07 Tobias Burnus David Malcolm Jakub Jelinek PR c/87488 * pretty-print.c (pp_begin_url, pp_end_url, test_urls): Use BEL instead of ST sequence to terminate OSC 8 strings. > > Which terminal are you using, and wha

[PATCH 2/4] analyzer: introduce a set of known async-signal-unsafe functions

2019-12-19 Thread David Malcolm
This patch uses the class function_set from the previous patch to generalize the test for an fprintf inside a signal handler to check for a set of known async-signal-unsafe functions. gcc/analyzer/ChangeLog: * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call selftest:

[PATCH 3/4] analyzer: add known stdio functions to sm-file.cc (PR analyzer/58237)

2019-12-19 Thread David Malcolm
The analyzer ought to report various file leaks for the reproducer in PR analyzer/58237, such as: void f1(const char *str) { FILE * fp = fopen(str, "r"); char buf[10]; while (fgets(buf, 10, fp) != NULL) { /* Do something with buf */ } /* Missing call to fclose. Ne

[PATCH 0/4] analyzer: add class function_set and use in various places

2019-12-19 Thread David Malcolm
On Wed, 2019-12-11 at 14:48 -0500, David Malcolm wrote: > On Sat, 2019-12-07 at 08:01 -0700, Jeff Law wrote: > > On Fri, 2019-11-15 at 20:23 -0500, David Malcolm wrote: > [...] > > > diff --git a/gcc/analyzer/analyzer.cc b/gcc/analyzer/analyzer.cc > > > new file m

[PATCH 1/4] analyzer: add function-set.cc/h

2019-12-19 Thread David Malcolm
1,191 @@ +/* Sets of function names. + Copyright (C) 2019 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Sof

[PATCH 4/4] analyzer: add -Wanalyzer-use-of-closed-file

2019-12-19 Thread David Malcolm
gcc/analyzer/ChangeLog: * analyzer.opt (Wanalyzer-use-of-closed-file): New option. * sm-file.cc (class use_of_closed_file): New file_diagnostic subclass. (find_file_param): New function. (fileptr_state_machine::on_stmt): Complain about operations on closed fi

[PATCH 2/2] analyzer: fix tests for UNKNOWN_LOCATION

2019-12-20 Thread David Malcolm
In the reproducer for PR analyzer/58237 I noticed that some events were missing locations (and text); for example event 3 here: | 15 | while (fgets(buf, 10, fp) != NULL) | | ~ | | | | | (2) following 'false' branch... | 'f1': event 3

[PATCH 1/2] (analyzer) tree-diagnostic-path.cc: properly handle ad-hoc wrappers of UNKNOWN_LOCATION

2019-12-20 Thread David Malcolm
In the reproducer for PR analyzer/58237 I noticed that some events that were missing locations were also missing text; for example event 3 here: | 15 | while (fgets(buf, 10, fp) != NULL) | | ~ | | | | | (2) following 'false' branch...

[PATCH] analyzer: ensure .dot output is valid for an empty BB

2019-12-20 Thread David Malcolm
This patch fixes an issue with the output of -fdump-analyzer-supergraph on BBs with no statements, where the resulting files were unreadable by dot e.g.: Error: syntax error in line 1 ... ... in label of node node_10 Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to the dm

Re: Bountysource campaign for gcc-rust?

2019-12-27 Thread David Malcolm
t; > The earlier, public discussions about a Rust front-end were open and > welcoming. The GCC Community and GCC Steering Committee would be > happy to consider a Rust front-end that can be contributed and > accepted into GCC and is maintainable. As David Malcolm previously > commen

[PATCH 2/2] analyzer: diagnostic_path: fix up expected analyzer output

2020-01-02 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to dmalcolm/analyzer on the GCC git mirror. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/analyzer-verbosity-0.c: Update expected output to remove source code from diagnostic locus, made redundant by path.

[PATCH 1/2] analyzer: diagnostic_path: avoid printing redundant data

2020-01-02 Thread David Malcolm
This patch tweaks the default implementation of diagnostic_path printing (-fdiagnostics-path-format=inline-events) to be less verbose for various common cases. Consider this synthetic diagnostic from the test plugin: test.c: In function 'test': test.c:29:5: error: passing NULL as argument 1 to 'P

[PATCH 1/2] analyzer: delete checker_event::clone

2020-01-03 Thread David Malcolm
checker_event has a clone vfunc implemented by all the concrete subclasses, but this is never used (a holdover from a very early implementation). This patch deletes it. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to dmalcolm/analyzer on the GCC git mirror. gcc/analyzer/

[PATCH 2/2] analyzer: cleanups to checker_path

2020-01-03 Thread David Malcolm
This patch adds DISABLE_COPY_AND_ASSIGN to checker_path, and makes its fields private. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to dmalcolm/analyzer on the GCC git mirror. gcc/analyzer/ChangeLog: * checker-path.h (checker_path::get_checker_event): New function

[PATCH] analyzer: fix global-sm-state issue affecting sm-signal

2020-01-03 Thread David Malcolm
sm-signal.cc was failing to warn about the use of an fprintf call in a signal handler when the signal handler function was non-static. The root cause was a failure to copy global sm-state within sm_state_map::clone_with_remapping as called by program_state::can_merge_with_p, which led to the explo

[PATCH 04/41] vec.h: add auto_delete_vec

2020-01-08 Thread David Malcolm
Needs review. Used by diagnostic_path patch and in various places in the analyzer. msebor raised some concerns about the v1 version of this patch here: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00221.html which I believe I addressed in v4: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg013

[PATCH 01/41] analyzer: user-facing documentation

2020-01-08 Thread David Malcolm
Sandra reviewed the v1 version of this patch here: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00549.html and noted that the organization could use some work. TODO: update re Sandra's ideas Changed in v4: - Use -fanalyzer rather than --analyzer - Add -W[no-]analyzer-unsafe-call-within-signal-

[PATCH 08/41] timevar.def: add TVs for analyzer

2020-01-08 Thread David Malcolm
Needs review. This takes the place of the auto_client_timevar code from v1 of the kit: https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01519.html gcc/ChangeLog: * timevar.def (TV_ANALYZER): New timevar. (TV_ANALYZER_SUPERGRAPH): Likewise. (TV_ANALYZER_STATE_PURGE): Likewis

[PATCH 05/41] Add -fdiagnostics-nn-line-numbers

2020-01-08 Thread David Malcolm
I may be able to self-approve this. It's used by the diagnostic_path patch, and by the analyzer test suite. Perhaps better to make undocumeted, or do it via a DejaGnu pruning directive, but I wanted to get v5 of the kit posted. This patch implements -fdiagnostics-nn-line-numbers, a new option wh

[PATCH 02/41] analyzer: internal documentation

2020-01-08 Thread David Malcolm
b/gcc/doc/analyzer.texi @@ -0,0 +1,513 @@ +@c Copyright (C) 2019 Free Software Foundation, Inc. +@c This is part of the GCC manual. +@c For copying conditions, see the file gcc.texi. +@c Contributed by David Malcolm . + +@node Static Analyzer +@chapter Static Analyzer +@cindex analyzer +@cindex stati

[PATCH 09/41] analyzer: add ChangeLog

2020-01-08 Thread David Malcolm
/analyzer/ChangeLog diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog new file mode 100644 index ..0fb3b3ce0111 --- /dev/null +++ b/gcc/analyzer/ChangeLog @@ -0,0 +1,10 @@ +2019-12-13 David Malcolm + + * Initial creation + + +Copyright (C) 2019-2020 Free Software Foundation

[PATCH 11/41] analyzer: add new files to Makefile.in

2020-01-08 Thread David Malcolm
Unchanged since v4; needs review gcc/ChangeLog: * Makefile.in (lang_opt_files): Add analyzer.opt. (ANALYZER_OBJS): New. (OBJS): Add digraph.o, graphviz.o, tristate.o and ANALYZER_OBJS. --- gcc/Makefile.in | 32 +++- 1 file changed, 31 insertions

[PATCH 14/41] analyzer: logging support

2020-01-08 Thread David Malcolm
ation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is dist

[PATCH 15/41] analyzer: new file: analyzer-pass.cc and pass registration

2020-01-08 Thread David Malcolm
lyzer with GCC's pass manager. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Fre

[PATCH 03/41] sbitmap.h: add operator const_sbitmap to auto_sbitmap

2020-01-08 Thread David Malcolm
Needs review. (Used in one place by region-model.cc) Changed in v5: - follow msebor's suggestion of using operator const_sbitmap rather than operator const sbitmap&, as per: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00224.html gcc/ChangeLog: * sbitmap.h (auto_sbitmap): Add operator c

[PATCH 07/41] Add ordered_hash_map

2020-01-08 Thread David Malcolm
Needs review. This is used in many places in the analyzer. msebor made some comments about the v1 version of this patch here: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00231.html Changed in v5: - updated copyright years to include 2020 This patch adds an ordered_hash_map template, which is

[PATCH 16/41] analyzer: new files: graphviz.{cc|h}

2020-01-08 Thread David Malcolm
a/gcc/graphviz.cc b/gcc/graphviz.cc new file mode 100644 index ..1185fdb41afb --- /dev/null +++ b/gcc/graphviz.cc @@ -0,0 +1,100 @@ +/* Helper code for graphviz output. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of

[PATCH 19/41] analyzer: new files: analyzer.{cc|h}

2020-01-08 Thread David Malcolm
-0,0 +1,150 @@ +/* Utility functions for the analyzer. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public Licen

[PATCH 20/41] analyzer: new files: tristate.{cc|h}

2020-01-08 Thread David Malcolm
". + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either

[PATCH 10/41] analyzer: changes to configure.ac

2020-01-08 Thread David Malcolm
Unchanged since v4; needs review. This patch adds a configuration option to disable building the analyzer. It is built by default (but off by default at compile-time). gcc/ChangeLog: * configure.ac (--disable-analyzer, ENABLE_ANALYZER): New option. (gccdepdir): Also create depdir

[PATCH 18/41] analyzer: new files: supergraph.{cc|h}

2020-01-08 Thread David Malcolm
2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any

[PATCH 23/41] analyzer: new files: pending-diagnostic.{cc|h}

2020-01-08 Thread David Malcolm
e 100644 index ..c88f17e6cff9 --- /dev/null +++ b/gcc/analyzer/pending-diagnostic.cc @@ -0,0 +1,64 @@ +/* Classes for analyzer diagnostics. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you ca

[PATCH 06/41] Add diagnostic paths

2020-01-08 Thread David Malcolm
false }, { "fixit-delete", SGR_SEQ (COLOR_FG_RED), 12, false }, { "diff-filename", SGR_SEQ (COLOR_BOLD), 13, false }, @@ -126,7 +127,7 @@ colorize_stop (bool show_color) /* Parse GCC_COLORS. The default would look like: GCC_COLORS='error=01;31:warning=01

[PATCH 29/41] analyzer: new file: sm-signal.cc

2020-01-08 Thread David Malcolm
-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option)

[PATCH 21/41] analyzer: new files: constraint-manager.{cc|h}

2020-01-08 Thread David Malcolm
/null +++ b/gcc/analyzer/constraint-manager.cc @@ -0,0 +1,2251 @@ +/* Tracking equivalence classes and constraints at a point on an execution path. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you

[PATCH 30/41] analyzer: new file: sm-taint.cc

2020-01-08 Thread David Malcolm
Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3

[PATCH 31/41] analyzer: new files: analysis-plan.{cc|h}

2020-01-08 Thread David Malcolm
00..6a4129b07a29 --- /dev/null +++ b/gcc/analyzer/analysis-plan.cc @@ -0,0 +1,118 @@ +/* A class to encapsulate decisions about how the analysis should happen. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is fr

[PATCH 32/41] analyzer: new files: call-string.{cc|h}

2020-01-08 Thread David Malcolm
program points. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation

[PATCH 40/41] gdbinit.in: add break-on-saved-diagnostic

2020-01-08 Thread David Malcolm
Needs review (or potentially falls under the "obvious" rule, at a stretch). This patch adds a "break-on-saved-diagnostic" command to gdbinit.in, useful for debugging when a diagnostic is queued by the analyzer. gcc/ChangeLog: * gdbinit.in (break-on-saved-diagnostic): New command. --- gcc

[PATCH 17/41] analyzer: new files: digraph.{cc|h} and shortest-paths.h

2020-01-08 Thread David Malcolm
. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the

[PATCH 33/41] analyzer: new files: program-point.{cc|h}

2020-01-08 Thread David Malcolm
Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version

[PATCH 25/41] analyzer: new files: sm-malloc.cc and sm-malloc.dot

2020-01-08 Thread David Malcolm
/gcc/analyzer/sm-malloc.cc @@ -0,0 +1,794 @@ +/* A state machine for detecting misuses of the malloc/free API. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +

[PATCH 34/41] analyzer: new files: program-state.{cc|h}

2020-01-08 Thread David Malcolm
Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any

[PATCH 00/41] v5 of analyzer patch kit

2020-01-08 Thread David Malcolm
/2019-12/msg00776.html Pushed to the git mirror as branch "dmalcolm/analyzer-v5": https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/dmalcolm/analyzer-v5 David Malcolm (41): analyzer: user-facing documentation analyzer: internal documentation sbitmap.h: add operator const

[PATCH 37/41] analyzer: new files: engine.{cc|h}

2020-01-08 Thread David Malcolm
c/analyzer/engine.cc new file mode 100644 index ..0c0b141a678c --- /dev/null +++ b/gcc/analyzer/engine.cc @@ -0,0 +1,3583 @@ +/* The analysis "engine". + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC i

[PATCH 27/41] analyzer: new file: sm-pattern-test.cc

2020-01-08 Thread David Malcolm
ributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed i

[PATCH 28/41] analyzer: new file: sm-sensitive.cc

2020-01-08 Thread David Malcolm
44 index ..94d637eeff6a --- /dev/null +++ b/gcc/analyzer/sm-sensitive.cc @@ -0,0 +1,245 @@ +/* An experimental state machine, for tracking exposure of sensitive + data (e.g. through logging). + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm .

[PATCH 24/41] analyzer: new files: sm.{cc|h}

2020-01-08 Thread David Malcolm
pyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, o

[PATCH 35/41] analyzer: new file: exploded-graph.h

2020-01-08 Thread David Malcolm
new file mode 100644 index ..22e8747c6ae2 --- /dev/null +++ b/gcc/analyzer/exploded-graph.h @@ -0,0 +1,830 @@ +/* Classes for managing a directed graph of pairs. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +

[PATCH 36/41] analyzer: new files: state-purge.{cc|h}

2020-01-08 Thread David Malcolm
state-purge.cc new file mode 100644 index ..61263d1edaeb --- /dev/null +++ b/gcc/analyzer/state-purge.cc @@ -0,0 +1,524 @@ +/* Classes for purging state at function_points. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part o

[PATCH 39/41] analyzer: new files: diagnostic-manager.{cc|h}

2020-01-08 Thread David Malcolm
Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option

[PATCH 13/41] analyzer: command-line options

2020-01-08 Thread David Malcolm
Needs review. msebor expressed some concerns in an earlier version of the patch here: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00233.html re overlap with existing functions, and very long names. For the former, they all have a "-Wanalyzer-" prefix to distinguish them, and for the latter, I

[PATCH 12/41] analyzer: new files: analyzer-selftests.{cc|h}

2020-01-08 Thread David Malcolm
@@ -0,0 +1,60 @@ +/* Selftest support for the analyzer. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as

[PATCH 38/41] analyzer: new files: checker-path.{cc|h}

2020-01-08 Thread David Malcolm
..b24952b9391b --- /dev/null +++ b/gcc/analyzer/checker-path.cc @@ -0,0 +1,931 @@ +/* Subclasses of diagnostic_path and diagnostic_event for analyzer diagnostics. + Copyright (C) 2019-2020 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free

[committed] hash-map-tests.c: fix memory leak

2020-01-08 Thread David Malcolm
This commit makes "make selftest-valgrind" clean by fixing this leak: 4 bytes in 1 blocks are definitely lost in loss record 1 of 734 at 0x483AB1A: calloc (vg_replace_malloc.c:762) by 0x261DBE0: xcalloc (xmalloc.c:162) by 0x2538C46: selftest::test_map_of_strings_to_int() (hash-map-tests.c

[PATCH] testsuite: add lib/nn-line-numbers.exp

2020-01-08 Thread David Malcolm
(replying to my own "[PATCH 05/41] Add -fdiagnostics-nn-line-numbers" with a followup that does it at the DejaGnu level rather than as a test-only option) On Wed, 2020-01-08 at 04:02 -0500, David Malcolm wrote: > I may be able to self-approve this. It's used by the diagnostic

Re: [PATCH 15/49] Add ordered_hash_map

2020-01-08 Thread David Malcolm
On Wed, 2019-12-04 at 10:59 -0700, Martin Sebor wrote: > On 11/15/19 6:23 PM, David Malcolm wrote: > > This patch adds an ordered_hash_map template, which is similar to > > hash_map, but preserves insertion order. > > > > gcc/ChangeLog: > > * Makefile.in (OB

Re: [PATCH 05/41] Add -fdiagnostics-nn-line-numbers

2020-01-08 Thread David Malcolm
On Wed, 2020-01-08 at 21:17 -0700, Jeff Law wrote: > On Wed, 2020-01-08 at 04:02 -0500, David Malcolm wrote: > > I may be able to self-approve this. It's used by the > > diagnostic_path > > patch, and by the analyzer test suite. Perhaps better to make > > und

[pushed] analyzer: fix ICE in call summarization [PR114159]

2024-02-29 Thread David Malcolm
param const. * function.h (function_name): Likewise. gcc/testsuite/ChangeLog: PR analyzer/114159 * c-c++-common/analyzer/call-summaries-pr114159.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.cc | 9 ++ gcc/analyzer/analyzer.h

Re: CI for "Option handling: add documentation URLs"

2024-03-04 Thread David Malcolm
On Sun, 2024-03-03 at 21:04 +0100, Mark Wielaard wrote: > Hi, > > On Sat, Feb 24, 2024 at 06:42:58PM +0100, Mark Wielaard wrote: > > On Thu, Feb 22, 2024 at 11:57:50AM +0800, YunQiang Su wrote: > > > Mark Wielaard 于2024年2月19日周一 06:58写道: > > > > So, I did try the regenerate-opt-urls locally, and i

Re: CI for "Option handling: add documentation URLs"

2024-03-05 Thread David Malcolm
On Tue, 2024-03-05 at 13:06 +0100, Mark Wielaard wrote: > Hi, > > On Mon, 2024-03-04 at 08:48 -0500, David Malcolm wrote: > > > I have now regenerated the patch to also include the new avr > > > mfuse- > > > add change. It would be nice to get this c

Frontend access to target features (was Re: [PATCH] libgccjit: Add ability to get CPU features)

2024-03-05 Thread David Malcolm
On Thu, 2023-11-09 at 19:33 -0500, Antoni Boucher wrote: > Hi. > See answers below. > > On Thu, 2023-11-09 at 18:04 -0500, David Malcolm wrote: > > On Thu, 2023-11-09 at 17:27 -0500, Antoni Boucher wrote: > > > Hi. > > > This patch adds support for getting the

Re: [PATCH] analyzer: Fix up some -Wformat* warnings

2024-03-07 Thread David Malcolm
On Thu, 2024-03-07 at 09:30 +0100, Jakub Jelinek wrote: > Hi! > > I'm seeing warnings like > ../../gcc/analyzer/access-diagram.cc: In member function ‘void > ana::bit_size_expr::print(pretty_printer*) const’: > ../../gcc/analyzer/access-diagram.cc:399:26: warning: unknown > conversion type charact

[pushed] analyzer: support null operands in remove_ssa_names

2024-03-18 Thread David Malcolm
such as e.g. for COMPONENT_REF's operand 2. Signed-off-by: David Malcolm --- gcc/analyzer/access-diagram.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc index 2836308c019..a9c5c899950 100644 --- a/gcc

[pushed] analyzer: fix ICEs due to sloppy types in bounds-checking [PR110902, PR110928, PR111305, PR111441]

2024-03-18 Thread David Malcolm
-diagram-11.c: Update expected diagram output. * c-c++-common/analyzer/out-of-bounds-diagram-pr110928.c: New test. * c-c++-common/analyzer/out-of-bounds-diagram-pr111305.c: New test. * c-c++-common/analyzer/out-of-bounds-diagram-pr111441.c: New test. Signed-off-by

[pushed] analyzer: fixes to __atomic_{exchange, load, store} [PR114286]

2024-03-19 Thread David Malcolm
mple, rather than user-facing signature. (class kf_atomic_load): Likewise. (class kf_atomic_store): New. (register_atomic_builtins): Register kf_atomic_store. gcc/testsuite/ChangeLog: PR analyzer/114286 * c-c++-common/analyzer/atomic-builtins-pr114286.c: Ne

Re: [PATCH] analyzer: Bail out on function pointer for -Wanalyzer-allocation-size

2024-03-19 Thread David Malcolm
On Tue, 2024-03-19 at 16:10 +0100, Stefan Schulze Frielinghaus wrote: > On s390 pr94688.c is failing due to excess error > > pr94688.c:6:5: warning: allocated buffer size is not a multiple of > the pointee's size [CWE-131] [-Wanalyzer-allocation-size] > > This is because on s390 functions are by

Re: ping: [PATCH] diagnostics: Fix behavior of permerror options after diagnostic pop [PR111918]

2024-03-19 Thread David Malcolm
On Tue, 2024-03-19 at 09:03 -0400, Lewis Hyatt wrote: > https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638692.html Sorry about the delay. The patch looks good for trunk, assuming it's passed the usual bootstrap and regression testing. Thanks Dave > > Thanks! > > On Fri, Feb 16, 2024

[pushed] diagnostics: fix corrupt json/SARIF on stderr [PR114348]

2024-03-19 Thread David Malcolm
chine_readable_stderr_p): New pure virtual function. (diagnostic_text_output_format::machine_readable_stderr_p): New. (diagnostic_context::get_output_format): New accessor. Signed-off-by: David Malcolm --- gcc/diagnostic-format-json.cc | 8 gcc/diagnostic-

[pushed] analyzer: fix ICE due to corrupt MEM_REFs [PR113505]

2024-03-19 Thread David Malcolm
From: Jakub Jelinek Jakub wrote this patch for PR analyzer/113505. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Successful run of analyzer integration tests on x86_64-pc-linux-gnu. Pushed to trunk as r14-9555-gc87f1f3d660f41. gcc/analyzer/ChangeLog PR analyzer/113505

[pushed] analyzer: fix -Wanalyzer-deref-before-check false positive seen in loop header macro [PR109251]

2024-03-20 Thread David Malcolm
heck-pr109251-2.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/sm-malloc.cc | 30 ++ .../analyzer/deref-before-check-pr109251-1.c | 60 +++ .../analyzer/deref-before-check-pr109251-2.c | 37 3 files changed, 127 insertions(+) cr

[pushed] analyzer: fix ignored constraints involving casts [PR113619]

2024-03-21 Thread David Malcolm
Fix cast-handling from r14-3632-ge7b267444045c5 so that if those give an unknown result, we continue trying the constraint manager. gcc/testsuite/ChangeLog: PR analyzer/113619 * c-c++-common/analyzer/taint-divisor-pr113619.c: New test. Signed-off-by: David Malcolm ---

[pushed] analyzer: add SARIF property bags to taint diagnostics

2024-03-22 Thread David Malcolm
tainted_offset::m_offset): New. (region_model::check_region_for_taint): Pass offset to tainted_offset ctor. Signed-off-by: David Malcolm --- gcc/analyzer/sm-taint.cc | 50 +--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/gcc/an

[pushed] analyzer: look through casts in taint sanitization [PR112974, PR112975]

2024-03-22 Thread David Malcolm
int-pr112974.c and taint-pr112975.c to analyzer_kernel_plugin.c. * gcc.dg/plugin/taint-pr112974.c: New test. * gcc.dg/plugin/taint-pr112975.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/sm-taint.cc | 8 +++ gcc/testsuite/gcc.dg/plugin/plugin.exp

[pushed] analyzer: fix ICE and false positive with -Wanalyzer-deref-before-check [PR114408]

2024-03-23 Thread David Malcolm
heck-pr114408.c: New test. * c-c++-common/ubsan/analyzer-ice-pr114408.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/engine.cc| 7 ++ gcc/analyzer/kf.cc| 22 +++ .../analyzer/deref-before-check-pr1144

[pushed] analyzer: fix ICE due to type mismatch when replaying call summary [PR114473]

2024-03-27 Thread David Malcolm
4473 * gcc.dg/analyzer/call-summaries-pr114473.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/call-summary.cc | 12 +++ .../gcc.dg/analyzer/call-summaries-pr114473.c | 31 +++ 2 files changed, 43 insertions(+) create mode 100644 gcc/tests

Re: [PATCH] Allow `gcc_jit_type_get_size` to work with pointers

2024-03-29 Thread David Malcolm
On Thu, 2024-03-28 at 23:47 +0100, Guillaume Gomez wrote: > Hi, > > Here's a little fix to allow the `gcc_jit_type_get_size` function to > work on pointer types as well. > Thanks, looks good to me. Are you able to push this, or do you want me to? Dave

[pushed] analyzer: prevent ICEs with null types

2024-04-02 Thread David Malcolm
ypes. * region-model.cc (apply_constraints_for_gswitch): Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.cc | 2 ++ gcc/analyzer/region-model.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/region-model-manager.cc b

[PATCH 1/9] wwwdocs: gcc-14: add caveat about not using analyzer on C++

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 4 1 file changed, 4 insertions(+) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 9fd224c1..5cc729c5 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -49,6 +49,10 @@ a work

[pushed] wwwdocs: gcc-14: various changes

2024-04-04 Thread David Malcolm
I've taken the liberty of pushing the following changes to the GCC 14 release notes. Hope they look reasonable. David Malcolm (9): gcc-14: add caveat about not using analyzer on C++ gcc-14: add URLs to some options gcc-14: add null_terminated_string_arg attribute gcc-14: c++:

[PATCH 2/9] wwwdocs: gcc-14: add URLs to some options

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 5cc729c5..397458d5 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14

[PATCH 7/9] wwwdocs: gcc-14: improvements for plugin authors

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 0701dc29..8b72bc20 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14

[PATCH 5/9] wwwdocs: gcc-14: libgccjit changes

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 31 ++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 95ed00c9..2dc7e598 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs

[PATCH 3/9] wwwdocs: gcc-14: add null_terminated_string_arg attribute

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 7 +++ 1 file changed, 7 insertions(+) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 397458d5..f9ce4fe5 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -191,6 +191,13 @@ a

[PATCH 9/9] wwwdocs: gcc-14: add 'Improvements to SARIF support' section

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 22 ++ 1 file changed, 22 insertions(+) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index d782c334..934cd1ad 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html

[PATCH 4/9] wwwdocs: gcc-14: c++: note changes to source quoting in template errors

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 7 +++ 1 file changed, 7 insertions(+) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index f9ce4fe5..95ed00c9 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -262,6 +262,13 @@ a

[PATCH 6/9] wwwdocs: gcc-14: improvements to automatic doc URLs for options

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 2dc7e598..0701dc29 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14

[PATCH 8/9] wwwdocs: gcc-14: analyzer improvements

2024-04-04 Thread David Malcolm
Signed-off-by: David Malcolm --- htdocs/gcc-14/changes.html | 162 + 1 file changed, 162 insertions(+) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 8b72bc20..d782c334 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14

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