From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 383A63858C62; Mon, 20 Mar 2023 20:20:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 383A63858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679343631; bh=sbuQ775huGUIg7o6y8agovOgpSmmjv2w4gRi4tyOVi0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=O3Jabl2WMGRnQNv2CCCWD6p02K7ko5JD8wKt0q1RosGleWIp1dI2rL6vDXPJe900T bBDLaJzPtEHiJXfK838v7F7xh6IB7ZVycff1p7ScsOYXcUqKkzSfEnwR0dN1GWOvJs qC2TgZurTzJ4oedfLPsYx3zd+L3+6tS2ZhCcPXaA= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109191] GCC static analyzer does not warning `*b = 1` where `b` is 1. Date: Mon, 20 Mar 2023 20:20:30 +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: dmalcolm 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=3D109191 --- Comment #1 from David Malcolm --- GCC does emit a -Wint-to-pointer-cast warning on this code, for the int to = void * conversion. Is this reduced from a real-world example, or just synthesized by hand? I suppose in theory the analyzer could: (a) figure out that it reads all zeroes from the array and complain about t= he null pointer deref, and/or (b) complain that we're accessing beyond the end of an array=