From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23440 invoked by alias); 22 Feb 2014 04:19:48 -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 23393 invoked by uid 48); 22 Feb 2014 04:19:45 -0000 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59193] Unused postfix operator temporaries Date: Sat, 22 Feb 2014 04:19: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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: trivial X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED 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: bug_status resolution 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: 2014-02/txt/msg02346.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59193 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |INVALID --- Comment #11 from Andrew Pinski --- (In reply to Max TenEyck Woodbury from comment #10) > There is no VARIABLE, just a TEMPORARY r-value like all the others that hold > intermediate results. Yes and temporary rvalues can be removed if unused. > > Also, the LANGUAGE semantics has the operator produce a result, an r-value, > that > has to be represented in some manner, that is, it has a store of some kind. > The machine code generated without optimization is required to put that > result > into the store before incrementing the specified l-value. (sub-clause > 6.2.5.4) > Optimization is allowed to, but not required to, remove such operations as > long > as the change produces no detectable change in the program's results. Yes but rvalues are can be removed as unused. > > Now, stop misrepresenting the standard. It makes your other pronouncements > less credible. I am not misrepresenting the standard here as there is a conversion between lvalue and rvalue here. > > To go over this again, if a piece of code specifies a postfix operation > conceptually, the original value is stored somewhere. That stored value is > then > discarded. Those steps are extraneous and the code would be conceptually > cleaner without them. As such, their present is a defect, a trivial defect, > but > still a defect. Using the prefix operator in its place improves to code, > again > trivially, but it does improve it. Such changes may want to cite something > as > justification for the change. This report is such a justification. Until > all > such defects have been removed, it should stay open. Again the rvalues can be removed as unused. This is allowed in the standard and so the semantics of the tree codes is that if the result is unused then there is no rvalue that happens.