From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23498 invoked by alias); 11 May 2010 12:49:26 -0000 Received: (qmail 22351 invoked by uid 48); 11 May 2010 12:48:53 -0000 Date: Tue, 11 May 2010 12:49:00 -0000 Message-ID: <20100511124853.22350.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/44062] (void)var; doesn't prevent 'set but not used' warning In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg01124.txt.bz2 ------- Comment #4 from jakub at gcc dot gnu dot org 2010-05-11 12:48 ------- Created an attachment (id=20628) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20628&action=view) gcc46-pr44062-c++.patch C++ change that fixes this. It treats all (void) / static_cast conversions and the implicit conversion thereof on lhs of compound expr as when a decl etc. is appearing alone in a statement, with the difference that for say (a, b++, c = d); we don't mark c DECL_READ_P - mark_exp_read normally handles MODIFY_EXPR for cases like z = (c = d); where we want to set DECL_READ_P on c. But in this case of a cast to void/decl/handled component alone in a stmt or comma expression lhs, we want to mark everything but MODIFY_EXPR. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44062