From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F7CD3858D32; Mon, 23 Jan 2023 10:44:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F7CD3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674470688; bh=V6GiT8n/uIMTSZvS9fHpEUyHZpfUVuqOevkuVLvSi08=; h=From:To:Subject:Date:From; b=dEQHD1GWZ1LAvUCqL8m+dAAKguudYShbpQzjVSX7IwafRQZTze0hI2CN4B7TTKVOx ZR4HVP/zfDG7DFBnxBIHRwJcEkzSjlfw5XIdJYa+iyfTOrsy4wPgba1i8srYv0supS zgTSKEhl4On6cUb9m1SlY2GSEyaAyu8rbJU1AWCg= From: "mengli.ming at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/108492] New: __analyzer_eval has effect on the analysis result of gcc static analyzer Date: Mon, 23 Jan 2023 10:44:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: mengli.ming at outlook dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D108492 Bug ID: 108492 Summary: __analyzer_eval has effect on the analysis result of gcc static analyzer Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: mengli.ming at outlook dot com Target Milestone: --- case: ```c void __analyzer_eval(); void f(int b) { int c =3D 1; __analyzer_eval(c && (c =3D 0) | b); if (c && (c =3D 0) | b) { int *p =3D (int *)0; __analyzer_eval(c && (c =3D 0) | b); if (c && (c =3D 0) | b) { *p =3D 42; } } } ``` In this case, when `__analyzer_eval` is added at line 6 (https://godbolt.org/z/defnzqKPn), the eval statement inside the if branch = has no output. However, when line 6 is commented out (https://godbolt.org/z/j4dGGEM1s), then the result is output.=20 Also, the eval result of `(c && (c =3D 0) | b)` should probably be TRUE aft= er analyzer goes inside the if branch. Thank you for taking the time to review this case.=