From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31813 invoked by alias); 25 Nov 2013 22:49:58 -0000 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 Received: (qmail 31776 invoked by uid 48); 25 Nov 2013 22:49:54 -0000 From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/58950] [4.9 Regression] Missing "statement has no effect" Date: Mon, 25 Nov 2013 22:49:00 -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: 4.9.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg02617.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58950 --- Comment #2 from Marc Glisse --- For __builtin_shuffle, the issue is that we now call save_expr, which always sets TREE_SIDE_EFFECTS to 1. I don't know if it would make sense to introduce a maybe_save_expr that is equivalent to save_expr but does not set TREE_SIDE_EFFECTS if its argument doesn't have it. But in any case I think we still want to warn for an unused result in __builtin_shuffle(x,++m) so that's not the solution. In C we also have the side_effects_flag but we still warn in warn_if_unused_value (the default for unknown trees), whereas in C++ (near the end of convert_to_void in cvt.c) only some tcc_comparison, tcc_unary and tcc_binary can warn when they have side effects. It would be easy to add VEC_PERM_EXPR to the list and get a "value computed is not used", I just don't know if something more general is possible. For (i+i), the PLUS_EXPR ends up with nowarning_flag = 1 somehow.