From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E2F75385840F; Fri, 24 Feb 2023 14:21:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2F75385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677248490; bh=uGdSSCG4XwpCOdds+jxjqhnNAnkSSm2SrmuVrSrxlAw=; h=From:To:Subject:Date:From; b=FCfXjWGpEiVTql6qGgPUiCHfrIE9/exAcyk/ns7RdVYFp4ofOdGgDNrc5WAMRMhI2 1+72MXsCZQUXO/iUw4qZMp/VP777/447GHOeLgUper8um0FJnwo8OAAP0W63whYZfJ SvvIBvhyT5ulPQ5C0YgZClUQ0NL8ULzxfhGiP8lc= From: "dcb314 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108926] New: No warning for same expression in chain of | or & ? Date: Fri, 24 Feb 2023 14:21:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dcb314 at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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=3D108926 Bug ID: 108926 Summary: No warning for same expression in chain of | or & ? Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- Static analyser cppcheck has the ability to produce a style warning for the same identifier used multiple times in the same expression. Two examples are linux-6.2/drivers/spi/spi-sn-f-ospi.c:614:31: style: Same expression 'SPI_TX_OCTAL' found multiple times in chain of '|' operators. [duplicateExpression] Source code is ctlr->mode_bits =3D SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_OCTAL | SPI_MODE_0 | SPI_MODE_1 | SPI_LSB_FIRST; linux-6.2/tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_m= arked_sample_test.c:68:10: style: Same expression '0x3' found multiple times in chain of '&' operators. [duplicateExpression] If gcc had this ability, then two kernel bugs would be found easily. I will check binutils and glibc. This bug is related to 53357.=