From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9FB0C3858410; Thu, 18 Jan 2024 17:12:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FB0C3858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705597937; bh=fwzTh23H710RvOSSJzuAe5fCMq5o8cVMZnPYTemxWko=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RBYzopkfZTiZDV8TSZ+OZNrWR9qFDbcgLFq+FCPIoD+ilLRb7VLohaJFkpx6f8KPa ryAk3jek8ozhho1+FigroK4BGLec7Wpw2ID/k+Pgj+VsaAo5FQrSRee/SY0zv4FqYd Btae7RT/8TF9896T/hqYnHKZrp+kW69LNxG5K+X4= From: "cvs-commit at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112811 --- Comment #1 from GCC Commits --- The master branch has been updated by David Malcolm : https://gcc.gnu.org/g:84096e665c5f7d7ffb07f18a5fd5e804a94b237b commit r14-8256-g84096e665c5f7d7ffb07f18a5fd5e804a94b237b Author: David Malcolm 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 svalu= e. (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 b= ody to... (region_model::scan_for_null_terminator_1): ...this new functio= n, 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 =