From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BB8443858D39; Fri, 31 Dec 2021 22:34:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB8443858D39 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/101537] -Wconversion false positive in ternary and |= Date: Fri, 31 Dec 2021 22:34:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2021 22:34:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101537 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- Created attachment 52105 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52105&action=3Dedit gcc12-pr101537.patch Untested fix. The PR101537 is fixed by this in both C and C++, PR103881 on= ly in C; for C++ we end up with a COMPOUND_EXPR with TARGET_EXPR and then BIT_IOR_EXPR of something and the TARGET_EXPR_DECL. We'd need to remember = when looking through COMPOUND_EXPRs if they don't have TARGET_EXPRs on the lhs a= nd if so, remember for conversion_warning the mapping from their TARGET_EXPR_D= ECLs to those TARGET_EXPRs, so that we could then look those up. But it seems unsafe_conversion_p has some BIT_*_EXPR handling code, so that would need to be copied over into conversion_warning too. Or perhaps alternatively we could change unsafe_conversion_p to handle what= ever is missing in there (SAVE_EXPRs, TARGET_EXPRs etc.).=