public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors
@ 2014-02-02  9:35 joaquin at tid dot es
  2014-02-04  8:21 ` [Bug c++/60027] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: joaquin at tid dot es @ 2014-02-02  9:35 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5147 bytes --]

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(<brace-enclosed initializer
list>)' 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: <gcc-bugs-return-442306-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
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: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
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" <gcc-bugzilla@gcc.gnu.org>
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: <bug-60028-4@http.gcc.gnu.org/bugzilla/>
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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
@ 2014-02-04  8:21 ` redi at gcc dot gnu.org
  2022-12-03 18:50 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2014-02-04  8:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-02-04
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
  2014-02-04  8:21 ` [Bug c++/60027] " redi at gcc dot gnu.org
@ 2022-12-03 18:50 ` pinskia at gcc dot gnu.org
  2022-12-03 18:52 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-03 18:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nruslan_devel at yahoo dot com

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107958 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
  2014-02-04  8:21 ` [Bug c++/60027] " redi at gcc dot gnu.org
  2022-12-03 18:50 ` pinskia at gcc dot gnu.org
@ 2022-12-03 18:52 ` pinskia at gcc dot gnu.org
  2022-12-03 18:52 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-03 18:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ldionne.2 at gmail dot com

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 102247 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
                   ` (2 preceding siblings ...)
  2022-12-03 18:52 ` pinskia at gcc dot gnu.org
@ 2022-12-03 18:52 ` pinskia at gcc dot gnu.org
  2022-12-03 18:53 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-03 18:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |konstantin.vladimirov@gmail
                   |                            |.com

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 97220 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
                   ` (3 preceding siblings ...)
  2022-12-03 18:52 ` pinskia at gcc dot gnu.org
@ 2022-12-03 18:53 ` pinskia at gcc dot gnu.org
  2023-05-31 19:50 ` [Bug c++/60027] [DR1228] " jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-03 18:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/llvm/llv
                   |                            |m-project/issues/28016

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note clang accepting this code is recorded as
https://github.com/llvm/llvm-project/issues/28016 .

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] [DR1228] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
                   ` (4 preceding siblings ...)
  2022-12-03 18:53 ` pinskia at gcc dot gnu.org
@ 2023-05-31 19:50 ` jason at gcc dot gnu.org
  2023-08-11 17:22 ` jason at gcc dot gnu.org
  2024-02-12  5:03 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2023-05-31 19:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmatthews at utexas dot edu

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
*** Bug 109864 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] [DR1228] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
                   ` (5 preceding siblings ...)
  2023-05-31 19:50 ` [Bug c++/60027] [DR1228] " jason at gcc dot gnu.org
@ 2023-08-11 17:22 ` jason at gcc dot gnu.org
  2024-02-12  5:03 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2023-08-11 17:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
Note that for PR109247 I've changed how this is handled in the case of using
the explicit constructor to initialize the argument of a copy/move constructor
or op=, which should make some of the duplicates work.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/60027] [DR1228] Problem with braced-init-lists and explicit ctors
  2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
                   ` (6 preceding siblings ...)
  2023-08-11 17:22 ` jason at gcc dot gnu.org
@ 2024-02-12  5:03 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-12  5:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jlame646 at gmail dot com

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 113884 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-12  5:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-02  9:35 [Bug c++/60027] New: Problem with braced-init-lists and explicit ctors joaquin at tid dot es
2014-02-04  8:21 ` [Bug c++/60027] " redi at gcc dot gnu.org
2022-12-03 18:50 ` pinskia at gcc dot gnu.org
2022-12-03 18:52 ` pinskia at gcc dot gnu.org
2022-12-03 18:52 ` pinskia at gcc dot gnu.org
2022-12-03 18:53 ` pinskia at gcc dot gnu.org
2023-05-31 19:50 ` [Bug c++/60027] [DR1228] " jason at gcc dot gnu.org
2023-08-11 17:22 ` jason at gcc dot gnu.org
2024-02-12  5:03 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).