From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26486 invoked by alias); 19 Feb 2014 06:15:52 -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 26459 invoked by uid 48); 19 Feb 2014 06:15:48 -0000 From: "mtewoodbury at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59193] Unused postfix operator temporaries Date: Wed, 19 Feb 2014 06:15: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: minor 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/msg01912.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 #4 from Max TenEyck Woodbury --- There is another semantic element to the a++ operator; the temporary where the original value of the variable is stored until used. You are either unaware of this aspect of the language or are deliberately ignoring it. This has NOTHING to do with overloading the postfix operators. This is part of the basic definition of the C language. In fact, C does NOT have operator overloading and the majority of GCC is written in C, not C++. Without optimization, this temporary store is allocated and set even if the value is never used. The fact that to value is not used and need never be set is detected during optimization. The fact that the temporary store is then never used and can be eliminated requires further optimization. All this extra work is unnecessary in well written code. That makes the use of a++ where ++a will do a minor coding defect. This bug report provides a referent for changes that improve that kind of defective code. Since there are hundreds, if not thousands of instances of this defect in the GCC code and there is no urgency in correcting these defects, this bug will only get resolved slowly. Closing it for invalid reasons does the community a disservice.