public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/112811] ICE in -fanalyzer in has_null_terminator
Date: Thu, 18 Jan 2024 17:12:15 +0000	[thread overview]
Message-ID: <bug-112811-4-BRbn6VxQLw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112811-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112811

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:84096e665c5f7d7ffb07f18a5fd5e804a94b237b

commit r14-8256-g84096e665c5f7d7ffb07f18a5fd5e804a94b237b
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Jan 18 12:11:57 2024 -0500

    analyzer: fix offsets in has_null_terminator [PR112811]

    PR analyzer/112811 reports an ICE attempting to determine whether a
    string is null-terminated.

    The root cause is confusion in the code about whether byte offsets are
    relative to the start of the base region, or relative to the bound
    fragment within the the region.

    This patch rewrites the code to enforce a clearer separation between
    the kinds of offset, fixing the ICE, and adds logging to help track
    down future issues in this area of the code.

    gcc/analyzer/ChangeLog:
            PR analyzer/112811
            * region-model.cc (fragment::dump_to_pp): New.
            (fragment::has_null_terminator): Convert to...
            (svalue_byte_range_has_null_terminator_1): ...this new function,
            updating to use a byte_range relative to the start of the svalue.
            (svalue_byte_range_has_null_terminator): New.
            (fragment::string_cst_has_null_terminator): Convert to...
            (string_cst_has_null_terminator): ...this, updating to use a
            byte_range relative to the start of the svalue.
            (iterable_cluster::dump_to_pp): New.
            (region_model::scan_for_null_terminator): Add logging, moving body
            to...
            (region_model::scan_for_null_terminator_1): ...this new function,
            adding more logging, and updating to use
            svalue_byte_range_has_null_terminator.
            * 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 <dmalcolm@redhat.com>

  reply	other threads:[~2024-01-18 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 15:12 [Bug analyzer/112811] New: " dmalcolm at gcc dot gnu.org
2024-01-18 17:12 ` cvs-commit at gcc dot gnu.org [this message]
2024-01-18 17:21 ` [Bug analyzer/112811] " dmalcolm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112811-4-BRbn6VxQLw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).