public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
@ 2014-02-22 18:09 JuergenGCC at bund dot us
  2021-08-30  3:16 ` [Bug c++/60318] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: JuergenGCC at bund dot us @ 2014-02-22 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60318
           Summary: Documentation bug: C++ Misunderstandings: Implicit
                    Copy-Assignment for Virtual Bases
           Product: gcc
           Version: unknown
               URL: http://gcc.gnu.org/onlinedocs/gcc/Copy-Assignment.html
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: JuergenGCC at bund dot us

That document states "In the example, copying proceeds in the following order:
‘val’, ‘name’ (via strdup), ‘bval’, and ‘name’ again."
Instead, it should read: "In the example, copying proceeds in the following
order: ‘name’ (via strdup), ‘val’, ‘name’ again, and ‘bval’."
>From gcc-bugs-return-444636-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Feb 22 19:34:42 2014
Return-Path: <gcc-bugs-return-444636-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1910 invoked by alias); 22 Feb 2014 19:34:40 -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 1889 invoked by uid 48); 22 Feb 2014 19:34:37 -0000
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/60319] New: wrong code (that hangs) by LTO at -Os and above on x86_64-linux-gnu
Date: Sat, 22 Feb 2014 19:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: su at cs dot ucdavis.edu
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-60319-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/msg02393.txt.bz2
Content-length: 1368

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`319

            Bug ID: 60319
           Summary: wrong code (that hangs) by LTO at -Os and above on
                    x86_64-linux-gnu
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk miscompiles the following code when using LTO at -Os and
above on x86_64-linux-gnu (both 32-bit and 64-bit modes).

This also affects the earlier versions of GCC from 4.6 to 4.8.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20140222 (experimental) [trunk revision 208040] (GCC)
$
$ gcc-trunk -flto -O0 -c foo.c
$ gcc-trunk -flto -O0 -c main.c
$
$ gcc-trunk -flto -O1 foo.o main.o
$ a.out
$
$ gcc-trunk -flto -Os foo.o main.o
$ a.out
^C
$
$ cat foo.c
void foo (char c)
{
  for (c = 0; c >= 0; c++)
    ;
}
$ cat main.c
extern void foo (char c);

int main ()
{
 foo(0);
 return 0;
}


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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
@ 2021-08-30  3:16 ` pinskia at gcc dot gnu.org
  2021-08-31  8:42 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-30  3:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|http://gcc.gnu.org/onlinedo |
                   |cs/gcc/Copy-Assignment.html |
           Keywords|                            |documentation

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
http://gcc.gnu.org/onlinedocs/gcc/Copy-Assignment.html

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
  2021-08-30  3:16 ` [Bug c++/60318] " pinskia at gcc dot gnu.org
@ 2021-08-31  8:42 ` redi at gcc dot gnu.org
  2021-08-31  9:09 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-31  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-31
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed. The example code is broken as well (missing return, -Wwrite-strings
violation).

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
  2021-08-30  3:16 ` [Bug c++/60318] " pinskia at gcc dot gnu.org
  2021-08-31  8:42 ` redi at gcc dot gnu.org
@ 2021-08-31  9:09 ` redi at gcc dot gnu.org
  2021-09-08 21:34 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-31  9:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/578453.html

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
                   ` (2 preceding siblings ...)
  2021-08-31  9:09 ` redi at gcc dot gnu.org
@ 2021-09-08 21:34 ` cvs-commit at gcc dot gnu.org
  2021-09-08 23:30 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-08 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:3c64582372cf445eabc4f9e99def7e33fb0270ee

commit r12-3423-g3c64582372cf445eabc4f9e99def7e33fb0270ee
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 09:46:41 2021 +0100

    c++: Fix docs on assignment of virtual bases [PR60318]

    The description of behaviour is incorrect, the virtual base gets
    assigned before entering the bodies of A::operator= and B::operator=,
    not after.

    The example is also ill-formed (passing a string literal to char*) and
    undefined (missing return from Base::operator=).

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    gcc/ChangeLog:

            PR c++/60318
            * doc/trouble.texi (Copy Assignment): Fix description of
            behaviour and fix code in example.

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
                   ` (3 preceding siblings ...)
  2021-09-08 21:34 ` cvs-commit at gcc dot gnu.org
@ 2021-09-08 23:30 ` cvs-commit at gcc dot gnu.org
  2021-09-08 23:31 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-08 23:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:d7b2e9bd1a3cdb502bfd837d56ef809817ef0db7

commit r11-8974-gd7b2e9bd1a3cdb502bfd837d56ef809817ef0db7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 09:46:41 2021 +0100

    c++: Fix docs on assignment of virtual bases [PR60318]

    The description of behaviour is incorrect, the virtual base gets
    assigned before entering the bodies of A::operator= and B::operator=,
    not after.

    The example is also ill-formed (passing a string literal to char*) and
    undefined (missing return from Base::operator=).

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    gcc/ChangeLog:

            PR c++/60318
            * doc/trouble.texi (Copy Assignment): Fix description of
            behaviour and fix code in example.

    (cherry picked from commit 3c64582372cf445eabc4f9e99def7e33fb0270ee)

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
                   ` (4 preceding siblings ...)
  2021-09-08 23:30 ` cvs-commit at gcc dot gnu.org
@ 2021-09-08 23:31 ` cvs-commit at gcc dot gnu.org
  2021-09-08 23:34 ` cvs-commit at gcc dot gnu.org
  2021-09-08 23:35 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-08 23:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b9f52acb7dc74fb7b4591f98d81cdcf54b36df38

commit r10-10102-gb9f52acb7dc74fb7b4591f98d81cdcf54b36df38
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 09:46:41 2021 +0100

    c++: Fix docs on assignment of virtual bases [PR60318]

    The description of behaviour is incorrect, the virtual base gets
    assigned before entering the bodies of A::operator= and B::operator=,
    not after.

    The example is also ill-formed (passing a string literal to char*) and
    undefined (missing return from Base::operator=).

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    gcc/ChangeLog:

            PR c++/60318
            * doc/trouble.texi (Copy Assignment): Fix description of
            behaviour and fix code in example.

    (cherry picked from commit 3c64582372cf445eabc4f9e99def7e33fb0270ee)

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
                   ` (5 preceding siblings ...)
  2021-09-08 23:31 ` cvs-commit at gcc dot gnu.org
@ 2021-09-08 23:34 ` cvs-commit at gcc dot gnu.org
  2021-09-08 23:35 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-08 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:03b8e26897fbddec10a703cf518280af675e6458

commit r9-9715-g03b8e26897fbddec10a703cf518280af675e6458
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 09:46:41 2021 +0100

    c++: Fix docs on assignment of virtual bases [PR60318]

    The description of behaviour is incorrect, the virtual base gets
    assigned before entering the bodies of A::operator= and B::operator=,
    not after.

    The example is also ill-formed (passing a string literal to char*) and
    undefined (missing return from Base::operator=).

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    gcc/ChangeLog:

            PR c++/60318
            * doc/trouble.texi (Copy Assignment): Fix description of
            behaviour and fix code in example.

    (cherry picked from commit 3c64582372cf445eabc4f9e99def7e33fb0270ee)

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

* [Bug c++/60318] Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases
  2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
                   ` (6 preceding siblings ...)
  2021-09-08 23:34 ` cvs-commit at gcc dot gnu.org
@ 2021-09-08 23:35 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-09-08 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.5
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for all active branches. Thanks for the report, sorry it took so long to
fix!

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

end of thread, other threads:[~2021-09-08 23:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-22 18:09 [Bug c++/60318] New: Documentation bug: C++ Misunderstandings: Implicit Copy-Assignment for Virtual Bases JuergenGCC at bund dot us
2021-08-30  3:16 ` [Bug c++/60318] " pinskia at gcc dot gnu.org
2021-08-31  8:42 ` redi at gcc dot gnu.org
2021-08-31  9:09 ` redi at gcc dot gnu.org
2021-09-08 21:34 ` cvs-commit at gcc dot gnu.org
2021-09-08 23:30 ` cvs-commit at gcc dot gnu.org
2021-09-08 23:31 ` cvs-commit at gcc dot gnu.org
2021-09-08 23:34 ` cvs-commit at gcc dot gnu.org
2021-09-08 23:35 ` redi 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).