From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 377C43858CDA; Tue, 6 Sep 2022 15:18:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 377C43858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662477523; bh=zDN2szcOOVybFV1x5UivdYe7l6gakDPUz8x7o15IHjg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AcDrO0RW5K7/Q9u1fAsSHzm+d7XIB3uUk1VjOrDK6/cSe8UbBheicnzONNNlgHAUd PNnOCQig5bhHQHG79Dxge834F3T/FQyqaZI/3USzqRIo0QUS/jQqLgiUznWoruMVYl 8WhTvCqOcDK/nDK1I1aBg6U6USPZGIPOD4wFkSP8= From: "tlange at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/106845] [13 Regression] ICE in exceeds_p, at analyzer/store.cc:464 since r13-2029-g7e3b45befdbbf1a1 Date: Tue, 06 Sep 2022 15:18:42 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tlange at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D106845 --- Comment #3 from Tim Lange --- Thanks for the report! (In reply to David Malcolm from comment #2) > (gdb) call this->dump() > bytes 1-0 This should be the read_bytes in region_model::check_region_bounds, with the start being the offset and the last byte being the offset + num_bytes - 1. = So the number of accessed bytes seems to return 0. I do use get_byte_size_sval () to retrieve the num_bytes. For the sized_reg= ion, the m_byte_size_sval is returned, which is set to buf_size aka 0 inside impl_call_memset. So the bug is that the caller proceeds to check for overf= lows even if no bytes are accessed. Solutions would be: 1. Bail out in the region_model::check_region_bounds if (tree_int_cst_equal (num_bytes_tree, integer_zero_node)). Maybe also add an assertion to the constructor of byte_range that m_size_in_bytes > 0. 2. Returning false if either THIS or OTHER has a size =3D=3D 0 in byte_range::exceeds_p and byte_range::falls_short_p. It seems to me that the implementations of byte_range/bit_range get_last_byte_offset () already assume that m_size_in_bytes should be great= er than zero. So I think the first one should the preferred fix.=