From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CCB173858D37; Thu, 6 Oct 2022 21:04:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCB173858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665090282; bh=RsxVKA1NIZ60tiT3m5LbljIwhlVDwrSSJgU0mLT6YC0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cCHBxawoy9VPQCy58Cz8gqdSSD1qma6AggHStc9EBGZW7kIWzfZysNU0oXHKv49Kc /r8M4riBNQHJmSV7UOPqwwQl4mTDCVvun2DOH76FAUmSRysSHWBRr/pIoBYeMlB0aV /nQAsAqlwHpZnGrJ0ZH98m8DPm1aL1i356c4l3eE= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/105783] -Wanalyzer-null-dereference false positive with union and functions Date: Thu, 06 Oct 2022 21:04:41 +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: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED 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: bug_status everconfirmed cf_reconfirmed_on 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=3D105783 David Malcolm changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2022-10-06 --- Comment #1 from David Malcolm --- Thanks for filing this bug. Confirmed with trunk. Adding: __analyzer_describe (0, t->counting); immediately before the conditional shows we have: :16:5: warning: svalue: 'CAST(int, BITS_WITHIN('_Bool', start: 0, s= ize: 1, next: 1, inner_val: (unsigned char)1))' 16 | __analyzer_describe (0, t->counting); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ so presumably the analyzer isn't smart enough to determine that that's nonz= ero. Note to self: MCVE is Stack Overflow's acronym for a "minimal, complete and verifiable example" (https://stackoverflow.com/help/minimal-reproducible-example)=