From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26389 invoked by alias); 30 Nov 2013 15:36:31 -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 26334 invoked by uid 48); 30 Nov 2013 15:36:26 -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: Sat, 30 Nov 2013 15:36: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/msg03116.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58950 --- Comment #8 from Marc Glisse --- (In reply to Eric Botcazou from comment #5) > > 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. > > No, this would defeat the purpose of the SAVE_EXPR, since you could > duplicate the expression or move it at will, leading to nasty order of > evaluation issues. What I meant was, there are many places in the front-end that do: if (TREE_SIDE_EFFECTS (op0)) op0 = save_expr (op0); and I'd like to replace it with op0 = maybe_save_expr (op0); that would do the same thing to begin with. Now, if op0 is a long expression without side-effects, the code I quoted will not call save_expr, it will duplicate the expression and count on CSE for dedup, whereas we could imagine having a single version to start with, that optimizations would still be allowed to duplicate as usual if they consider it worth it. Of course the uses of SAVE_EXPR that require the stronger protection would be left alone. I may still not be making sense, but at least I think I was a little more precise about what I meant ;-)