From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1484 invoked by alias); 15 Jan 2014 07:23:50 -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 1439 invoked by uid 48); 15 Jan 2014 07:23:44 -0000 From: "jakub at gcc dot gnu.org" 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:23: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: jakub at gcc dot gnu.org 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/msg01530.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59813 --- Comment #5 from Jakub Jelinek --- If you only care about tail recursion and not tail call optimization, perhaps, but either solution would be very dumb. We now have var ={v} {CLOBBER}; stmts, even if those vars escape and are address taken, if there is a clobber stmt for those vars on every path from the escape point to the tail call candidate, we could perform tail recursion or tail call optimization, what we are really after is that the address of no automatic variable from the current function can escape to the tail recursion/call candidate. As in: void bar (char *); void foo (char *p) { char c; bar (&c); bar (NULL); // We can't tail call optimize this } void baz (char *p) { { char c; bar (&c); } bar (NULL); // We could tail call optimize this }