From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32032 invoked by alias); 15 Jan 2014 07:18:05 -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 31947 invoked by uid 48); 15 Jan 2014 07:18:00 -0000 From: "virkony at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/59813] tail-call elimintation didn't fired with left-shift of char to cout Date: Wed, 15 Jan 2014 07:18: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.8.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: virkony at gmail dot com X-Bugzilla-Status: NEW 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: 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-01/txt/msg01529.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59813 --- Comment #4 from Nikolay Orliuk --- Andrew Pinski, as long as address of variable isn't taken out of scope of function that is being tail-call optimized there is no need to worry about it and it is safe to optimize. Am I wrong? If stdc++ lib contains code like: ostream &operator<<(ostream &os, char x) { os.__escape = &x; } That's probably wrong and should be fixed. Tried to override with: ostream &operator<<(ostream &os, char x) { cout.put(x); return os; } // works on all 4.5.4, 4.7.3 and 4.8.2 ostream &operator<<(ostream &os, char x) { cout.write(&x, 1); return os; } // fails even without "bar" for 4.7.3 and 4.8.2 Note that strange behaviour of 4.7.3. Is that means that adding "bar" fires inlining?..