[committed 3/7] analyzer: add note about valid subscripts [PR106626]

2022-11-30 Thread David Malcolm via Gcc-patches
t-arr.c: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/bounds-checking.cc | 46 +-- .../gcc.dg/analyzer/call-summaries-2.c| 1 + .../gcc.dg/analyzer/out-of-bounds-1.c | 16 --- .../analyzer/out-of-bounds-write-char-arr.c | 6 +++ .../analy

[committed 2/7] analyzer: fix wording of 'number of bad bytes' note [PR106626]

2022-11-30 Thread David Malcolm via Gcc-patches
analyzer/out-of-bounds-read-int-arr.c: Likewise. * gcc.dg/analyzer/out-of-bounds-write-char-arr.c: Likewise. * gcc.dg/analyzer/out-of-bounds-write-int-arr.c: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/bounds-checking.cc | 66 --- .../analyzer/out-of-bo

[committed] analyzer: fix ICE on bind/connect with a constant fd [PR107928]

2022-11-30 Thread David Malcolm via Gcc-patches
t_passive_open_from_bind. (test_passive_open_from_listen_constant): New, adapted from test_passive_open_from_listen. Signed-off-by: David Malcolm --- gcc/analyzer/sm-fd.cc | 6 +- gcc/analyzer/sm-fd.dot| 6 ++ .../gcc.dg/analyzer/fd-bind-pr107928.c

[committed] analyzer work on issues with flex-generated lexers [PR103546]

2022-11-29 Thread David Malcolm via Gcc-patches
getc-1.c: New test. * gcc.dg/analyzer/isatty-1.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h |1 + gcc/analyzer/program-state.cc |2 + gcc/analyzer/region-model-impl-calls.cc |1 + gcc/analyzer/sm-f

[committed] analyzer: move stdio known fns to sm-file.cc

2022-11-29 Thread David Malcolm via Gcc-patches
t;fread", and "getchar" to here from register_known_functions. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-impl-calls.cc | 111 gcc/analyzer/sm-file.cc | 106 ++ 2 files changed, 106 insertions(+), 11

[committed] analyzer: fix folding of '(PTR + 0) => PTR' [PR105784]

2022-11-29 Thread David Malcolm via Gcc-patches
EXPR and MINUS_EXPR, eliminate requirement that the final type matches that of arg0 in favor of a cast. gcc/testsuite/ChangeLog: PR analyzer/105784 * gcc.dg/analyzer/torture/fold-ptr-arith-pr105784.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manage

Re: [PATCH v2 16/19] modula2 front end: bootstrap and documentation tools

2022-11-25 Thread David Malcolm via Gcc-patches
On Thu, 2022-11-24 at 14:30 +, Gaius Mulley via Gcc-patches wrote: > Martin Liška writes: > > > On 11/8/22 14:22, Gaius Mulley wrote: > > > Martin Liška writes: > > > > > > should be good - I'll complete the rst output in the scripts, > > > > Hi. > > > > Hi Martin, > > > As you

[committed] analyzer: fix nondeterminism in logs

2022-11-23 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-4275-ge0f18b87bfaf0b. gcc/analyzer/ChangeLog: * checker-path.cc (checker_path::inject_any_inlined_call_events): Don't dump the address of the block when -fdump-noaddr. Signed-off-by: D

[committed] analyzer: revamp of heap-allocated regions [PR106473]

2022-11-23 Thread David Malcolm via Gcc-patches
st. * gcc.dg/analyzer/malloc-reuse.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/call-summary.cc | 4 +- gcc/analyzer/program-state.cc | 4 +- gcc/analyzer/region-model-impl-calls.cc | 8 +-- gcc/analyzer/region-model-manager.cc

[committed 1/2] analyzer: move known funs for fds to sm-fd.cc

2022-11-23 Thread David Malcolm via Gcc-patches
ten): Likewise. (class kf_accept): Likewise. (class kf_connect): Likewise. (class kf_pipe): Likewise. (register_known_fd_functions): New. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h | 1 + gcc/analyzer/region-model-impl-

[committed 2/2] analyzer: eliminate region_model::on_ fns for sockets

2022-11-23 Thread David Malcolm via Gcc-patches
odel): Likewise fo on_connect... (region_model::on_connect): ...eliminating this function. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.h | 5 -- gcc/analyzer/sm-fd.cc | 144 2 files changed, 49 insertions(+), 100 deletions(-)

Re: [PATCH] analyzer: Use __builtin_alloca in gcc.dg/analyzer/call-summaries-2.c

2022-11-23 Thread David Malcolm via Gcc-patches
On Wed, 2022-11-23 at 14:27 +0100, Rainer Orth wrote: > gcc.dg/analyzer/call-summaries-2.c currently FAILs on Solaris: > > FAIL: gcc.dg/analyzer/call-summaries-2.c (test for excess errors) > > Excess errors: > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/analyzer/call- >

Re: [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722]

2022-11-23 Thread David Malcolm via Gcc-patches
On Wed, 2022-11-23 at 09:51 +0100, Jakub Jelinek wrote: > Hi! > > As reported in the PR, since special_fname_builtin () call has been > introduced, the diagnostics code compares filename against _(" in>") > rather than "", which means that if self tests are > performed > with the string being

[committed] analyzer: only look for named functions in root ns [PR107788]

2022-11-22 Thread David Malcolm via Gcc-patches
y're not in the root namespace. gcc/testsuite/ChangeLog: PR analyzer/107788 * g++.dg/analyzer/named-functions.C: New test. Signed-off-by: David Malcolm --- gcc/analyzer/known-function-manager.cc | 15 --- gcc/testsuite/g++.dg/analyzer/named-functions.C

[committed] analyzer: fix ICE on 'bind(INT_CST, ...)' [PR107783]

2022-11-22 Thread David Malcolm via Gcc-patches
sten_on_connected_socket): Fix typo. (test_listen_on_constant): New. Signed-off-by: David Malcolm --- gcc/analyzer/sm-fd.cc | 9 ++--- gcc/testsuite/gcc.dg/analyzer/fd-accept.c | 5 + gcc/testsuite/gcc.dg/analyzer/fd-bind.c| 5 + gcc/testsuite/gcc.dg/a

[committed] analyzer: fix 'errno' on Solaris and OS X [PR107807]

2022-11-22 Thread David Malcolm via Gcc-patches
_error" as synonyms for "__errno_location". gcc/testsuite/ChangeLog: PR analyzer/107807 * gcc.dg/analyzer/errno-___errno.c: New test. * gcc.dg/analyzer/errno-__error.c: New test. * gcc.dg/analyzer/errno-global-var.c: New test. Signed-off-by: David Malcolm --- gcc/a

[committed] analyzer: eliminate region_model::impl_call_* special cases

2022-11-22 Thread David Malcolm via Gcc-patches
(region_model::impl_call_va_start): Convert to... (kf_va_start::impl_call_pre): ...this. (class kf_va_copy): New. (region_model::impl_call_va_copy): Convert to... (kf_va_copy::impl_call_pre): ...this. (class kf_va_arg): New. (region_mo

[committed] analyzer: fix ICE on 'bind' with non-pointer arg [P107783]

2022-11-21 Thread David Malcolm via Gcc-patches
bind::matches_call_types_p): Require that arg 1 be a pointer. * region-model.h (call_details::arg_is_pointer_p): New gcc/testsuite/ChangeLog: PR analyzer/107783 * gcc.dg/analyzer/fd-bind-pr107783.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-

[committed] analyzer: fix ICE on 'bind' that returns a struct [PR107788]

2022-11-21 Thread David Malcolm via Gcc-patches
type. (region_model::update_for_nonzero_return): Likewise. gcc/testsuite/ChangeLog: PR analyzer/107788 * g++.dg/analyzer/fd-bind-pr107783.C: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.cc | 4 gcc/testsuite/g++.dg/analyzer/fd-bind-pr10

[committed] analyzer: fix ICE on writes to errno [PR107777]

2022-11-21 Thread David Malcolm via Gcc-patches
RRNO in switch. * region-model.cc (region_model::get_representative_path_var_1): Likewise. gcc/testsuite/ChangeLog: PR analyzer/10 * gcc.dg/analyzer/call-summaries-errno.c: New test. * gcc.dg/analyzer/errno-pr10.c: New test. Signed-off-by: David Mal

[committed] analyzer, testsuite: add more examples taken from CWE

2022-11-21 Thread David Malcolm via Gcc-patches
. * gcc.dg/analyzer/malloc-CWE-415-examples.c: New test. * gcc.dg/analyzer/malloc-CWE-416-examples.c: New test. * gcc.dg/analyzer/malloc-CWE-590-examples.c: New test. Signed-off-by: David Malcolm --- .../gcc.dg/analyzer/CWE-131-examples.c| 146

[committed] analyzer: fix feasibility false +ve on jumps through function ptrs [PR107582]

2022-11-18 Thread David Malcolm via Gcc-patches
.c: New test. * gcc.dg/analyzer/feasibility-pr107582-1.c: New test. * gcc.dg/analyzer/feasibility-pr107582-2.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/engine.cc| 14 -- gcc/testsuite/gcc.dg/analyzer/feasibility-4.c |

[committed] analyzer: move more impl_* to known_function

2022-11-18 Thread David Malcolm via Gcc-patches
:impl_call_errno_location): Delete decl. (region_model::impl_call_pipe): Delete decl. (region_model::impl_call_putenv): Delete decl. (region_model::impl_call_operator_new): Delete decl. (region_model::impl_call_operator_delete): Delete decl.

[PATCH] c: fix ICE with -fanalyzer and -Wunused-macros [PR107711]

2022-11-16 Thread David Malcolm via Gcc-patches
_reader, rather than ident_hash, so that the new reader gets its own hash table. gcc/testsuite/ChangeLog: PR analyzer/107711 * gcc.dg/analyzer/named-constants-Wunused-macros.c: New test. Signed-off-by: David Malcolm --- gcc/c/c-parser.cc | 2 +-

[committed] analyzer: more test coverage for named constants

2022-11-16 Thread David Malcolm via Gcc-patches
-undef.c: New test. Signed-off-by: David Malcolm --- .../named-constants-via-command-line.c| 10 + .../analyzer/named-constants-via-macros-3.c | 15 + .../analyzer/named-constants-via-macros-4.c | 15 + .../named-constants-via-macros-empty.c| 14

[committed] analyzer: log the stashing of named constants [PR107711]

2022-11-16 Thread David Malcolm via Gcc-patches
s when closing the dump file. gcc/testsuite/ChangeLog: PR analyzer/107711 * gcc.dg/analyzer/fdump-analyzer-1.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer-language.cc | 42 +--- gcc/analyzer/analyzer.h

[committed] analyzer: use known_function to simplify region_model::on_call_{pre, post}

2022-11-16 Thread David Malcolm via Gcc-patches
boundary_fn::matches_call_types_p): New. * gcc.dg/plugin/analyzer_known_fns_plugin.c (known_function_returns_42::matches_call_types_p): New. (known_function_attempt_to_copy::matches_call_types_p): New. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h

[committed] analyzer: split out checker-path.cc into a new checker-event.cc

2022-11-16 Thread David Malcolm via Gcc-patches
yzer/ChangeLog: * checker-event.cc: New file, split out from... * checker-path.cc: ...this file. Signed-off-by: David Malcolm --- gcc/Makefile.in |1 + gcc/analyzer/checker-event.cc | 1213 + gcc/analyzer/checker-path.cc |

Re: [PATCH v2] analyzer: add warnings relating to sockets [PR106140]

2022-11-15 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-11 at 22:27 -0500, David Malcolm wrote: > Changed in v2: ported doc changes from texinfo to sphinx > > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. > > I can self-approve this patch, but it depends on the named constants > patch he

Re: why does gcc jit require pthread?

2022-11-15 Thread David Malcolm via Gcc-patches
[Fixing typo in the Subject ("git" -> "jit" ); CCing jit mailing list] On Fri, 2022-11-11 at 17:16 +, Jonathan Wakely wrote: > On Mon, 7 Nov 2022 at 13:51, Jonathan Wakely wrote: > > > > On Mon, 7 Nov 2022 at 13:33, LIU Hao wrote: > > > > > > 在 2022-11-07 20:57, Jonathan Wakely 写道: > > > >

[PATCH v3] c, analyzer: support named constants in analyzer [PR106302]

2022-11-15 Thread David Malcolm via Gcc-patches
On Mon, 2022-11-14 at 15:42 -0500, Marek Polacek wrote: > On Fri, Nov 11, 2022 at 10:23:10PM -0500, David Malcolm wrote: > > Changes since v1: ported the doc changes from texinfo to sphinx > > > > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. > >

[committed] analyzer: new warning: -Wanalyzer-tainted-assertion [PR106235]

2022-11-13 Thread David Malcolm via Gcc-patches
taint-assert-system-header.c: New test. * gcc.dg/analyzer/test-assert.h: New header. * gcc.dg/plugin/analyzer_gil_plugin.c (gil_diagnostic::fixup_location): Add bool param. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.opt | 4 + gcc/analyzer

Re: [PATCH v2] c, analyzer: support named constants in analyzer [PR106302]

2022-11-11 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-11 at 22:23 -0500, David Malcolm wrote: > Changes since v1: ported the doc changes from texinfo to sphinx > > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. > > Are the C frontend parts OK for trunk?  (I can self-approve the > analyz

[PATCH v2] analyzer: add warnings relating to sockets [PR106140]

2022-11-11 Thread David Malcolm via Gcc-patches
Add -Wno-analyzer-too-complex and -Wno-analyzer-fd-leak to options. * gcc.dg/analyzer/pr104369-2.c: Add -Wno-analyzer-fd-leak to options. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer-language.cc |2 + gcc/analyzer/analyzer.opt |

[PATCH v2] c, analyzer: support named constants in analyzer [PR106302]

2022-11-11 Thread David Malcolm via Gcc-patches
er/fd-dup-1.c (O_ACCMODE): Define. * gcc.dg/analyzer/named-constants-via-enum.c: New test. * gcc.dg/analyzer/named-constants-via-macros-2.c: New test. * gcc.dg/analyzer/named-constants-via-macros.c: New test. Signed-off-by: David Malcolm --- gcc/Makefile.in

Re: Announcement: Porting the Docs to Sphinx - 9. November 2022

2022-11-11 Thread David Malcolm via Gcc-patches
On Mon, 2022-10-17 at 15:28 +0200, Martin Liška wrote: > Hello. > > Based on the very positive feedback I was given at the Cauldron > Sphinx Documentation BoF, > I'm planning migrating the documentation on 9th November. There are > still some minor comments > from Sandra when it comes to the PDF

[committed] analyzer: more state machine documentation

2022-11-11 Thread David Malcolm via Gcc-patches
gcc/analyzer/ChangeLog: * sm-fd.dot: Fix typo in comment. * sm-file.dot: New file. * varargs.cc: Fix typo in comment. * varargs.dot: New file. Signed-off-by: David Malcolm --- gcc/analyzer/sm-fd.dot | 2 +- gcc/analyzer/sm-file.dot | 67

[committed] analyzer: split out checker_event classes to their own header

2022-11-11 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3913-g65752c1f7c41c5. gcc/analyzer/ChangeLog: * checker-path.h: Split out checker_event and its subclasses to... * checker-event.h: ...this new header. Signed-off-by: David Malcolm ---

[committed] analyzer: new warning: -Wanalyzer-infinite-recursion [PR106147]

2022-11-11 Thread David Malcolm via Gcc-patches
inite recursions occur. * gcc.dg/analyzer/malloc-ipa-12.c: Likewise. * gcc.dg/analyzer/pr105365.c: Likewise. * gcc.dg/analyzer/pr105366.c: Likewise. * gcc.dg/analyzer/pr97029.c: Likewise. Signed-off-by: David Malcolm --- gcc/Makefile.in

[committed] analyzer: new warning: -Wanalyzer-deref-before-check [PR99671]

2022-11-10 Thread David Malcolm via Gcc-patches
* gcc.dg/analyzer/malloc-1.c (test_51): New test. gcc/ChangeLog: PR analyzer/99671 * tristate.h (tristate::is_unknown): New. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.opt | 4 + gcc/analyzer/diagnostic-manager.cc| 12 + gcc/

[committed] analyzer: better logging of event creation

2022-11-09 Thread David Malcolm via Gcc-patches
ager::emit_saved_diagnostic): Pass logger to checker_path ctor. (diagnostic_manager::add_events_for_eedge): Log scope when processing a run of stmts. Signed-off-by: David Malcolm --- gcc/analyzer/checker-path.cc | 29 + gcc/analyzer/checker-pa

Re: [PATCH] doc: Use a separate directory for new modules we add to PATH

2022-11-09 Thread David Malcolm via Gcc-patches
On Wed, 2022-11-09 at 22:31 +0100, Arsen Arsenović via Gcc-patches wrote: > ChangeLog: > > * doc/baseconf.py: Inject dirname(__file__)/'modules' to path > instead of just ``.''. > * doc/gcc_sphinx.py: Moved to... > * doc/modules/gcc_sphinx.py: ...here. > --- >

[committed] analyzer: eliminate region_model::eval_condition_without_cm [PR101962]

2022-11-08 Thread David Malcolm via Gcc-patches
/101962 * gcc.dg/analyzer/data-model-23.c (test_3): New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-impl-calls.cc | 2 +- gcc/analyzer/region-model.cc | 75 +++ gcc/analyzer/region-model.h | 3 - gcc/testsu

PING: Re: [PATCH] c, analyzer: support named constants in analyzer [PR106302]

2022-11-07 Thread David Malcolm via Gcc-patches
h. Thanks Dave On Mon, 2022-10-31 at 15:07 -0400, David Malcolm wrote: > The analyzer's file-descriptor state machine tracks the access mode > of > opened files, so that it can emit -Wanalyzer-fd-access-mode-mismatch. > > To do this, its symbolic execution needs to "know&

[PATCH] analyzer: add warnings relating to sockets [PR106140]

2022-11-07 Thread David Malcolm via Gcc-patches
New test. * gcc.dg/analyzer/pr104369-1.c: Add -Wno-analyzer-too-complex and -Wno-analyzer-fd-leak to options. * gcc.dg/analyzer/pr104369-2.c: Add -Wno-analyzer-fd-leak to options. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer-language.cc |

[commited] analyzer: start adding support for errno

2022-11-07 Thread David Malcolm via Gcc-patches
gcc/testsuite/ChangeLog: * gcc.dg/analyzer/errno-1.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-impl-calls.cc | 14 ++ gcc/analyzer/region-model-manager.cc| 2 + gcc/analyzer/region-model-manager.h | 4 ++ gcc/analyzer/region-model.cc

[committed] analyzer: fix "when 'strchr' returns non-NULL" message

2022-11-07 Thread David Malcolm via Gcc-patches
all_post): ...here. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/strchr-1.c (test_literal): Detect writing to a string literal. Verify that we emit the "when '__builtin_strchr' returns non-NULL" message. Signed-off-by: David Malcolm --- gcc/analyze

[committed] analyzer: introduce succeed_or_fail_call_info

2022-11-07 Thread David Malcolm via Gcc-patches
wise. (succeed_or_fail_call_info::get_desc): New. * call-info.h (class succeed_or_fail_call_info): New. (class success_call_info): Convert to a subclass of succeed_or_fail_call_info. (class failed_call_info): Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/

Re: [PATCH 4/6] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2022-11-05 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > Add a new linemap reason LC_GEN which enables encoding the location > of data > that was generated during compilation and does not appear in any > source file. > There could be many use cases, such as, for instance, referring

Re: [PATCH RFA] input: add get_source_text_between

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 13:06 -0400, Jason Merrill wrote: > On 11/4/22 11:16, David Malcolm wrote: > > On Fri, 2022-11-04 at 10:27 -0400, Jason Merrill wrote: > > > On 11/3/22 19:06, David Malcolm wrote: > > > > On Thu, 2022-11-03 at 15:59 -0400, Jason Merrill via Gcc-

Re: [PATCH 5a/6] diagnostics: Handle generated data locations in edit_context

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 17:05 -0400, Lewis Hyatt wrote: > [PATCH 5a/6] diagnostics: Handle generated data locations in > edit_context > > Class edit_context handles outputting fixit hints in diff form that > could be > manually or automatically applied by the user. This will not make > sense for >

Re: [PATCH 5b/6] diagnostics: Remove null-termination requirement for json::string

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 17:05 -0400, Lewis Hyatt wrote: > [PATCH 5b/6] diagnostics: Remove null-termination requirement for > json::string > > json::string currently handles null-terminated data and so can't work > with > data that may contain embedded null bytes or that is not null- > terminated.

Re: [PATCH 5/6] diagnostics: Support generated data in additional contexts

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > Add awareness that diagnostic locations may be in generated buffers > rather > than an actual file to other places in the diagnostics code that may > care, > most notably SARIF output (which needs to obtain its own snapshots

Re: [PATCH 2/6] diagnostics: Use an inline function rather than hardcoding string

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > The string "" is hard-coded in several places throughout > the > diagnostics code, and in some of those places, it is used incorrectly > with > respect to internationalization. (Comparing a translated string to an >

Re: [PATCH 1/6] diagnostics: Fix macro tracking for ad-hoc locations

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > The result of linemap_resolve_location() can be an ad-hoc location, > if that is > what was stored in a relevant macro map.  > maybe_unwind_expanded_macro_loc() > did not previously handle this case, causing it to print the

Re: [PATCH RFA] input: add get_source_text_between

2022-11-04 Thread David Malcolm via Gcc-patches
On Fri, 2022-11-04 at 10:27 -0400, Jason Merrill wrote: > On 11/3/22 19:06, David Malcolm wrote: > > On Thu, 2022-11-03 at 15:59 -0400, Jason Merrill via Gcc-patches > > wrote: [...snip...] > > > > > > Do you have test coverage for this from the DejaGnu sid

Re: [PATCH RFA] input: add get_source_text_between

2022-11-03 Thread David Malcolm via Gcc-patches
On Thu, 2022-11-03 at 15:59 -0400, Jason Merrill via Gcc-patches wrote: > Tested x86_64-pc-linux-gnu, OK for trunk? > > -- >8 -- > > The c++-contracts branch uses this to retrieve the source form of the > contract predicate, to be returned by contract_violation::comment(). > > gcc/ChangeLog: >

[committed 8/8] analyzer: use std::unique_ptr for state machines from plugins

2022-11-03 Thread David Malcolm via Gcc-patches
gcc/analyzer/ChangeLog: * analyzer.h: Use std::unique_ptr for state machines from plugins. * engine.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.c: Use std::unique_ptr for state machines from plugins. Signed-off-by: David Malcolm

[committed 5/8] analyzer: use std::unique_ptr for checker_event

2022-11-03 Thread David Malcolm via Gcc-patches
-signal.cc: Likewise. * varargs.cc: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/call-info.cc | 9 +- gcc/analyzer/checker-path.cc | 25 ++--- gcc/analyzer/checker-path.h| 4 +- gcc/analyzer/diagnostic-manager.cc | 146 +++-- gcc

[committed 1/8] analyzer: use std::unique_ptr for pending_diagnostic/note

2022-11-03 Thread David Malcolm via Gcc-patches
ct_in_call): Use make_unique when creating pending_diagnostic. (gil_state_machine::on_stmt): Likewise. (gil_state_machine::check_for_pyobject_usage_without_gil): Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.c: : Add define of INCLUDE_MEMORY. * gcc.dg/plugin/analyzer_kno

[committed 6/8] analyzer: use std::unique_ptr during bifurcation

2022-11-03 Thread David Malcolm via Gcc-patches
: Include "make-unique.h". Use std::unique_ptr in bifurcation code. * gcc.dg/plugin/analyzer_known_fns_plugin.c: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/analysis-plan.cc | 1 + gcc/analyzer/analyzer-pass.cc | 1 + gc

[committed 7/8] analyzer: use std::unique_ptr for known functions

2022-11-03 Thread David Malcolm via Gcc-patches
::unique_ptr for known functions. * gcc.dg/plugin/analyzer_known_fns_plugin.c: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h | 2 +- gcc/analyzer/engine.cc | 4 ++-- gcc/analyzer/known-function

[committed 3/8] analyzer: use std::unique_ptr for custom_edge_info pointers

2022-11-03 Thread David Malcolm via Gcc-patches
-by: David Malcolm --- gcc/analyzer/checker-path.cc | 2 +- gcc/analyzer/engine.cc| 52 +-- gcc/analyzer/exploded-graph.h | 11 +++- gcc/analyzer/sm-signal.cc | 2 +- 4 files changed, 25 insertions(+), 42 deletions(-) diff --git a/gcc/analyzer

[committed 2/8] analyzer: use std::unique_ptr for saved_diagnostic::m_stmt_finder

2022-11-03 Thread David Malcolm via Gcc-patches
. (impl_sm_context::m_stmt_finder): Likewise. (leak_stmt_finder::clone): Convert return type to std::unique_ptr. * exploded-graph.h (stmt_finder::clone): Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/diagnostic-manager.cc | 7 +++ gcc/analyzer/diagnostic-manager.h | 8

[committed 4/8] analyzer: use std::unique_ptr for feasibility_problems and exploded_path

2022-11-03 Thread David Malcolm via Gcc-patches
* exploded-graph.h: Likewise. * feasible-graph.cc: Likewise. * feasible-graph.h: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/diagnostic-manager.cc | 64 ++ gcc/analyzer/diagnostic-manager.h | 9 ++--- gcc/analyzer/engine.cc | 9

[committed 0/8] Use std::unique_ptr in analyzer

2022-11-03 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3629-g6341f14e369a5c through r13-3636-ge177be86c7d327. David Malcolm (8): analyzer: use std::unique_ptr for pending_diagnostic/note analyzer: use std::unique_ptr for saved_diagnostic::m_stmt_fi

[committed] analyzer: fix ICE when pipe's arg isn't a pointer [PR107486]

2022-11-03 Thread David Malcolm via Gcc-patches
odel::on_call_pre): Use it. (region_model::on_call_post): Likewise. gcc/testsuite/ChangeLog: PR analyzer/107486 * gcc.dg/analyzer/pipe-pr107486.c: New test. * gcc.dg/analyzer/pipe-void-return.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/analyze

[PATCH] c, analyzer: support named constants in analyzer [PR106302]

2022-10-31 Thread David Malcolm via Gcc-patches
acros.c: ...this. (O_ACCMODE): Define. * gcc.dg/analyzer/fd-access-mode-target-headers.c: New test, also based on fd-5.c. (test_sm_fd_constants): New. * gcc.dg/analyzer/fd-dup-1.c (O_ACCMODE): Define. * gcc.dg/analyzer/named-constants-via-enum.c: New test. * gcc.dg/an

Re: Rust frontend patches v3

2022-10-28 Thread David Malcolm via Gcc-patches
On Fri, 2022-10-28 at 17:20 +0200, Arthur Cohen wrote: > > > On 10/28/22 15:06, David Malcolm wrote: > > On Fri, 2022-10-28 at 13:48 +0200, Arthur Cohen wrote: > > > Hi David, > > > > > > On 10/26/22 23:15, David Malcolm wrote: > > > >

Re: Rust frontend patches v3

2022-10-28 Thread David Malcolm via Gcc-patches
On Fri, 2022-10-28 at 13:48 +0200, Arthur Cohen wrote: > Hi David, > > On 10/26/22 23:15, David Malcolm wrote: > > On Wed, 2022-10-26 at 10:17 +0200, arthur.co...@embecosm.com wrote: > > > This is the fixed version of our previous patch set for gccrs - &g

Re: [PATCH v2 2/3] libcpp: add a function to determine UTF-8 validity of a C string

2022-10-28 Thread David Malcolm via Gcc-patches
On Thu, 2022-10-27 at 19:16 -0400, Ben Boeckel wrote: > This simplifies the interface for other UTF-8 validity detections > when a > simple "yes" or "no" answer is sufficient. > > Signed-off-by: Ben Boeckel > --- >  libcpp/ChangeLog  |  6 ++ >  libcpp/charset.cc | 18 ++ >  

Re: [PATCH v2 1/3] libcpp: reject codepoints above 0x10FFFF

2022-10-28 Thread David Malcolm via Gcc-patches
On Thu, 2022-10-27 at 19:16 -0400, Ben Boeckel wrote: > Unicode does not support such values because they are unrepresentable > in > UTF-16. Wikipedia pointed me to RFC 3629, which was when UTF-8 introduced this restriction, whereas libcpp was implementing the higher upper limit from the earlier,

[committed] analyzer: fixes to file-descriptor handling

2022-10-26 Thread David Malcolm via Gcc-patches
d_from_symbolic_fd): New. (test_write_to_symbolic_fd): New. Signed-off-by: David Malcolm --- gcc/analyzer/sm-fd.cc| 34 ++-- gcc/testsuite/gcc.dg/analyzer/fd-3.c | 18 --- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/gcc/analyzer/sm-fd.cc b/gcc

[committed] analyzer: add sm-fd.dot

2022-10-26 Thread David Malcolm via Gcc-patches
Add a .dot file to document the file descriptor state machine. gcc/analyzer/ChangeLog: * sm-fd.dot: New file. Signed-off-by: David Malcolm --- gcc/analyzer/sm-fd.dot | 109 + 1 file changed, 109 insertions(+) create mode 100644 gcc/analyzer/sm

Re: Rust frontend patches v3

2022-10-26 Thread David Malcolm via Gcc-patches
On Wed, 2022-10-26 at 10:17 +0200, arthur.co...@embecosm.com wrote: > This is the fixed version of our previous patch set for gccrs - We've > adressed > the comments raised in our previous emails. [...snip...] (Caveat: I'm not a global reviewer) Sorry if this is answered in the docs in the

Re: [PATCH Rust front-end v3 35/46] gccrs: Add metadata ouptput pass

2022-10-26 Thread David Malcolm via Gcc-patches
%{On Wed, 2022-10-26 at 10:18 +0200, arthur.co...@embecosm.com wrote: > From: Philip Herron > > Extern crates statements to tell the front-end to look for another > library. > The mechanism here is heavily inspired from gccgo, so when we compile > a > library for example we invoke: >

Re: [PATCH Rust front-end v3 20/46] gccrs: Add wrapper for make_unique

2022-10-26 Thread David Malcolm via Gcc-patches
On Wed, 2022-10-26 at 10:17 +0200, arthur.co...@embecosm.com wrote: > From: Philip Herron > > This is a wrapper for make_unique we can likely get rid of this as > there > are other implementations available or simply keep using the > unique_ptr > constructor. [CCing Jonathan] As it happens, I

[PATCH v3] Add gcc/make-unique.h

2022-10-26 Thread David Malcolm via Gcc-patches
Changed in v3: added include of v2: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604137.html v1: https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598189.html On Tue, 2022-07-12 at 07:48 +0100, Jonathan Wakely wrote: > On Tue, 12 Jul 2022, 01:25 David Malcolm, > wrote: > &

Re: [PATCH 1/2] Add gcc/make-unique.h

2022-10-25 Thread David Malcolm via Gcc-patches
On Fri, 2022-10-21 at 12:01 -0400, David Malcolm wrote: > This patch adds gcc/make-unique.h, containing a minimal C++11 > implementation of make_unique (std::make_unique is C++14). > > The followup patch uses this in dozens of places within the analyzer. > > Success

[commited] analyzer: fix ICE on va_copy [PR107349]

2022-10-24 Thread David Malcolm via Gcc-patches
eLog: PR analyzer/107349 * gcc.dg/analyzer/stdarg-1-ms_abi.c (pr107349): New. * gcc.dg/analyzer/stdarg-1-sysv_abi.c (pr107349): New. * gcc.dg/analyzer/stdarg-1.c (pr107349): New. Signed-off-by: David Malcolm --- gcc/analyzer/varargs.cc

[committed] diagnostics: fix ICE in sarif output with NULL filename [PR107366]

2022-10-24 Thread David Malcolm via Gcc-patches
NULL filename. gcc/testsuite/ChangeLog: PR analyzer/107366 * gcc.dg/analyzer/sarif-pr107366.c: New test. Signed-off-by: David Malcolm --- gcc/diagnostic-format-sarif.cc| 2 +- .../gcc.dg/analyzer/sarif-pr107366.c | 20 +++ 2 files changed

[committed] analyzer: handle (NULL == ) [PR107345]

2022-10-24 Thread David Malcolm via Gcc-patches
fore checking for them. gcc/testsuite/ChangeLog: PR analyzer/107345 * gcc.dg/analyzer/pr107345.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.cc | 15 --- gcc/testsuite/gcc.dg/analyzer/pr107345.c | 17 + 2 f

[committed] analyzer: simplify sm_state_map lookup

2022-10-24 Thread David Malcolm via Gcc-patches
text::get_taint_map): Delete. (region_model_context_decorator::get_state_map_by_name): New. (region_model_context_decorator::get_fd_map): Delete. (region_model_context_decorator::get_malloc_map): Delete. (region_model_context_decorator::get_taint_map): Delete. Signed-off-by: D

[committed] analyzer: handle "pipe" and "pipe2" [PR106300]

2022-10-24 Thread David Malcolm via Gcc-patches
c: New test. * gcc.dg/analyzer/pipe-manpages.c: New test. * gcc.dg/analyzer/pipe2-1.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/engine.cc| 15 gcc/analyzer/exploded-graph.h | 3 + gcc/analyzer/region-model-impl-cal

[PATCH 2/2] analyzer: use std::unique_ptr for pending_diagnostic/note

2022-10-21 Thread David Malcolm via Gcc-patches
bject_usage_without_gil): Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.c: : Add define of INCLUDE_MEMORY. * gcc.dg/plugin/analyzer_known_fns_plugin.c: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/call-info.cc | 1 + gcc/analyzer/call-summary

[PATCH 1/2] Add gcc/make-unique.h

2022-10-21 Thread David Malcolm via Gcc-patches
eLog: * make-unique.h: New file. Signed-off-by: David Malcolm --- gcc/make-unique.h | 42 ++ 1 file changed, 42 insertions(+) create mode 100644 gcc/make-unique.h diff --git a/gcc/make-unique.h b/gcc/make-unique.h new file mode 100644 index 000

[committed] analyzer: fix ICE on __builtin_ms_va_copy [PR105765]

2022-10-19 Thread David Malcolm via Gcc-patches
copy): Update for renaming. (region_model::impl_call_va_copy): Likewise. gcc/testsuite/ChangeLog: PR analyzer/105765 * gcc.dg/analyzer/stdarg-1-ms_abi.c: New test, based on stdarg-1.c. * gcc.dg/analyzer/stdarg-1-sysv_abi.c: Likewise. Signed-off-by: David Mal

[committed] analyzer: fix ICE introduced in r13-3168 [PR107210]

2022-10-13 Thread David Malcolm via Gcc-patches
gcc/testsuite/ChangeLog: PR analyzer/107210 * gfortran.dg/analyzer/pr107210.f90: New test. Signed-off-by: David Malcolm --- gcc/analyzer/svalue.cc | 3 ++- gcc/testsuite/gfortran.dg/analyzer/pr107210.f90 | 16 2 files changed, 18 insert

Re: [DOCS] Python Language Conventions

2022-10-13 Thread David Malcolm via Gcc-patches
On Thu, 2022-10-13 at 11:44 +0200, Gerald Pfeifer wrote: > Hi Martin, > > On Thu, 13 Oct 2022, Martin Liška wrote: > > I think we should add how Python scripts should be formatted. I > > noticed > > that while reading the Modula-2 patchset where it follows the C/C++ > > style > > when it comes to

Re: [PATCH RESEND 0/1] RFC: P1689R5 support

2022-10-13 Thread David Malcolm via Gcc-patches
the changelog, some > > style, and > > `trtbd` instead of `p1689r5` as the format name). > > > > For testing within GCC, I'll work on the following: > > > > - scanning non-module source > > - scanning module-importing source (`import X;`) > > - scanni

[committed] analyzer: extract bits from integer constants [PR105783]

2022-10-07 Thread David Malcolm via Gcc-patches
ting a single bit. gcc/testsuite/ChangeLog: PR analyzer/105783 * gcc.dg/analyzer/pr105783.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model.cc | 52 gcc/analyzer/svalue.cc | 17 +++- gcc/testsuite/gc

[committed] analyzer: fixes to call_summary_replay::dump_to_pp

2022-10-06 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3137-g30d6356773a838. gcc/analyzer/ChangeLog: * call-summary.cc (call_summary_replay::dump_to_pp): Bulletproof against NULL caller regions/svalues. Signed-off-by: David Malcolm ---

[committed] analyzer: fix another ICE in PR 107158

2022-10-06 Thread David Malcolm via Gcc-patches
ster converts to a compound_svalue in the caller. gcc/testsuite/ChangeLog: PR analyzer/107158 * gcc.dg/analyzer/call-summaries-pr107158-2.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/store.cc | 34 +- .../analyzer/call-summaries-pr107158

[committed] analyzer: add regression test for PR 107158

2022-10-05 Thread David Malcolm via Gcc-patches
/analyzer/call-summaries-pr107158.c: New test. Signed-off-by: David Malcolm --- .../gcc.dg/analyzer/call-summaries-pr107158.c | 83 +++ 1 file changed, 83 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107158.c diff --git a/gcc/testsuite/gcc.dg

[committed] analyzer: simplify some includes

2022-10-05 Thread David Malcolm via Gcc-patches
* state-purge.cc: Likewise. * store.cc: Likewise. * store.h: Likewise. * supergraph.cc: Likewise. * svalue.cc: Likewise. * svalue.h: Likewise. * trimmed-graph.cc: Likewise. * varargs.cc: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/analysi

[committed] analyzer: fix ICEs seen with call summaries on PR 107060

2022-10-05 Thread David Malcolm via Gcc-patches
og: PR analyzer/107060 * gcc.dg/analyzer/analyzer-decls.h (__analyzer_get_unknown_ptr): New decl. * gcc.dg/analyzer/call-summaries-2.c (test_summarized_writes_param_to_ptr_unknown): New test. Signed-off-by: David Malcolm --- gcc/analyzer/c

[committed] analyzer: move region_model_manager decl to its own header

2022-10-04 Thread David Malcolm via Gcc-patches
odel-manager.h: ...this new file. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.h | 312 gcc/analyzer/region-model.h | 289 +- 2 files changed, 313 insertions(+), 288 deletions(-) create mode 100644 gcc/analyzer/region-m

[committed] analyzer: revamp side-effects of call summaries [PR107072]

2022-10-04 Thread David Malcolm via Gcc-patches
ic custom_edge_info. */ /* Implementation of custom_edge_info::print vfunc for call_info: use get_desc to get a label_text, and print it to PP. */ diff --git a/gcc/analyzer/call-summary.cc b/gcc/analyzer/call-summary.cc new file mode 100644 index 000..9d8716da96e --- /dev/null +++

[committed] analyzer: fold -(-(VAL)) to VAL

2022-10-04 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3075-g7f42f7adfa69fe. gcc/analyzer/ChangeLog: * region-model-manager.cc (region_model_manager::maybe_fold_unaryop): Fold -(-(VAL)) to VAL. Signed-off-by: David Malcolm --- gcc/analyzer/re

[committed] analyzer: widening_svalues take a function_point rather than a program_point

2022-10-04 Thread David Malcolm via Gcc-patches
alue::can_merge_p): Use a function_point rather than a program_point. (svalue::can_merge_p): Likewise. * svalue.h (widening_svalue::key_t): Likewise. (widening_svalue::widening_svalue): Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.cc

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