From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8FCC23858C2C; Tue, 7 Mar 2023 18:30:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FCC23858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678213848; bh=f4UgSVBCXqqhxVS109Xg2S9QgITBtZ4twLaFQSvrhO0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MI6mzLUtY16F+n8+cEyoeZA46txJL26ZfKWXD9KXtunG2FGBbx2zCaJm3QMJdeuh4 tKajYT4Sis13bgNPkCvj8Z9fq2y9shaf8bE8PUNbXYokneQiuity4MRaCjhVRKKagg FTsBbbuRAYrDLM5t3st87CQlhRnDHooRHFXz1SdQ= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109058] RFE: analyzer should elide repeated calls to strcmp in execution paths Date: Tue, 07 Mar 2023 18:30:48 +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=3D109058 --- Comment #1 from David Malcolm --- Even better would be for the event condition to express the string, when it= 's a string literal, so that it reads: ../../src/gcc/testsuite/gcc.dg/analyzer/strcmp-path-1.c:27:5: note: path 27 | __analyzer_dump_path (); | ^~~~~~~~~~~~~~~~~~~~~~~ =E2=80=98test=E2=80=99: events 1-3 | | 25 | } else if (strcmp (args[0], "opt-010") =3D=3D 0) { | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) following =E2=80=98true=E2=80=99 branch (when = args[0] is "opt-010")... | 26 | do_opt (10); | | ~~~~~~~~~~~ | | | | | (2) ...to here | 27 | __analyzer_dump_path (); | | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) here |=