http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027 Bug ID: 60027 Summary: Problem with braced-init-lists and explicit ctors Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joaquin at tid dot es The following code compiled with -std=c++11: struct foo { foo(int){} }; struct bar { explicit bar(int){} }; void f(foo){} void f(bar){} int main() { f({0}); } yields: main.cpp:16:8: error: call of overloaded 'f()' is ambiguous f({0}); ^ main.cpp:16:8: note: candidates are: main.cpp:11:6: note: void f(foo) void f(foo){} ^ main.cpp:12:6: note: void f(bar) void f(bar){} ^ which seems incorrect as bar::bar(int) is explicit. Joaquín M López Muñoz Telefónica Digital >From gcc-bugs-return-442306-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Feb 02 11:29:22 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 14098 invoked by alias); 2 Feb 2014 11:29:21 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 14056 invoked by uid 48); 2 Feb 2014 11:29:15 -0000 From: "wojtek.golf at interia dot pl" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/60028] New: TIC6X: B3 register (return address) is saved on stack when real call is replaced with sibling call in a leaf function Date: Sun, 02 Feb 2014 11:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wojtek.golf at interia dot pl X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: 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/msg00063.txt.bz2 Content-length: 2237 http://gcc.gnu.org/bugzilla/show_bug.cgi?id`028 Bug ID: 60028 Summary: TIC6X: B3 register (return address) is saved on stack when real call is replaced with sibling call in a leaf function Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: wojtek.golf at interia dot pl GCC 4.8.2, target tic6x Input source: int e_fun(int arg); extern int e_int; void g_fun(void) { e_fun(e_int); } compiled with a command: -fleading-underscore -marchÆ74x -O2 -g0 -S main.c gives the following assembler code: _g_fun: sub .d2 B15, 8, B15 stw .d2t2 B3, *+B15(8) b .s1 (_e_fun) || ldw .d2t1 *+B14(_e_int), A4 ldw .d2t2 *+B15(8), B3 || add .s2 8, B15, B15 ;; sibcall to (_e_fun) occurs nop 4 where B3 is saved on the stack even though a branch is taken to _e_fun. Texas Instruments CGTools compiler v7.3.2 (cl6x --gcc -mv6740 --symdebug:none -k -n main.c) gives the following assembler code (CALLRET is an alias to B): _g_fun: CALLRET .S1 _e_fun ; |6| LDW .D2T1 *+DP(_e_int),A4 ; |6| NOP 4 $C$RL0: ; CALL-RETURN OCCURS {_e_fun} 0 ; |6| where B3 is not saved. Some investigation on my part leads to the function c6x_expand_call in the file gcc/gcc/config/c6x/c6x.c, where we see what may cause B3 being marked as used and hence saved on the stack prior to the branch: if (sibcall) { call_insn = emit_call_insn (call_insn); use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), gen_rtx_REG (Pmode, REG_B3)); } commenting out use_reg invocation makes gcc to generate the expected listing: _g_fun: b .s1 (_e_fun) || ldw .d2t1 *+B14(_e_int), A4 ;; sibcall to (_e_fun) occurs nop 5 I haven't tested yet whether removal of use_reg invocation causes any regression, but I'd like it to be investigated whether it should be removed altogether or protected with some extra execution condition. With best, Wojciech