From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2576 invoked by alias); 22 Feb 2014 02:03:55 -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 1969 invoked by uid 48); 22 Feb 2014 02:03:50 -0000 From: "mtewoodbury at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59193] Unused postfix operator temporaries Date: Sat, 22 Feb 2014 02:03: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: mtewoodbury at gmail dot com X-Bugzilla-Status: REOPENED 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/msg02337.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59193 Max TenEyck Woodbury changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #10 from Max TenEyck Woodbury --- There is no VARIABLE, just a TEMPORARY r-value like all the others that hold intermediate results. 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. Now, stop misrepresenting the standard. It makes your other pronouncements less credible. 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.