From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 27A3E38708F2; Mon, 11 May 2020 13:39:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27A3E38708F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589204380; bh=5EUMICwM2AlzqRbdsY3iVE/fkTyZaQw8K+mb5pPRU8A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=q8olzlSnQ/21mvDUQjoAO++VmqxeM/fklCAFd120fk3XOKPztzlek+aofFDqekx19 1wAHGGT4byWpoRDjEzqtE390RHtz1vRcg6xR7CPVC6mbHc34ATyqt+OHel/J6FSdh8 E3n1huc6NLLoGVQNXMXJb+O0wKDhzzGzViQxRCaQ= From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/95057] missing -Wunused-but-set-variable warning on multiple assignments, not all of them used Date: Mon, 11 May 2020 13:39:40 +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: 10.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-gcc at vinc17 dot net 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: 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: Mon, 11 May 2020 13:39:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95057 --- Comment #4 from Vincent Lef=C3=A8vre --- OK, so the work (for this warning or a new one) should be done later, but e= arly enough not to be affected by optimizations. One of the goals would be to detect a missing check of a return value of a function call (typically an error status). For such a typical usage, the sa= me variable can be reused for each error status. int r; r =3D call1 (...); check (r); /* ... */ r =3D call2 (...); check (r); /* ... */ r =3D call3 (...); check (r); If a check is missing, there should be a warning.=