From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66DA6385C32C; Fri, 30 Sep 2022 08:28:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66DA6385C32C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664526480; bh=7tCfDQ+aO2WBmECz5hVpABHaVjq35zqZ8dZyu7RL+NE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l1asb3aAGfmWJ8xcKf07llxYe6INekrtCTjkDgCjo3KTn6wABby89LnvoT+NRovdX /J25AX3bYPtS0yVmW8ex/GuxhyrUP0/1fT/K6od6ZWZCXm8FZ8ClnFYhhHa40Mz7H6 NCTxHuH3o/MXTywJkcdorws9IrXrUAbWm5vBkIxE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107065] GCC treats rvalue as an lvalue Date: Fri, 30 Sep 2022 08:27:34 +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: 12.2.0 X-Bugzilla-Keywords: wrong-code 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 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=3D107065 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #12 from Jakub Jelinek --- Guess one possibility would be to teach the warning code to look through TRUTH_NOT_EXPR around stuff. Or we could at least temporarily invert_truthvalue_loc if arg is tcc_compar= ison or some similar special case. Or similarly we could (for the time being) always invert_truthvalue_loc, bu= t if the lvalue_kind of arg and val changes wrap it in NON_LVALUE_EXPR. Doing it on the match.pd side doesn't look right, there could be many other optimizations that result in something similar.=