public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "avi at scylladb dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105373] miscompile involving lambda coroutines and an object bitwise copied instead of via the copy constructor
Date: Thu, 28 Apr 2022 17:28:19 +0000	[thread overview]
Message-ID: <bug-105373-4-Wwb3nYks7p@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105373-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from Avi Kivity <avi at scylladb dot com> ---
Created attachment 52899
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52899&action=edit
simple(r) reproducer

I was able to reduce it to something simple (102 lines), but I was only able to
verify that wrong code is generated on the gimple level (where my understanding
is very limited). Still, to my inexperienced eyes it looks like an object with
a copy constructor is being copied bitwise.

Compile with (gcc 11.3.1)

    g++ -Wfatal-errors -w -std=gnu++20  -march=westmere -fvisibility=hidden  -c
-o table.o table.i -fdump-tree-gimple -g 

and observe in table.i.006t.gimple:

    struct lw_shared_ptr D.2740 [value-expr: frame_ptr->D.2740_4_5];

and then

    frame_ptr->D.2741_4_5.__old4 = frame_ptr->D.2740_4_5;


in other places, variables of the same type are copied using the copy
constructor.

  parent reply	other threads:[~2022-04-28 17:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25  9:31 [Bug c++/105373] New: " avi at scylladb dot com
2022-04-25 11:14 ` [Bug c++/105373] " avi at scylladb dot com
2022-04-25 11:47 ` avi at scylladb dot com
2022-04-25 12:21 ` avi at scylladb dot com
2022-04-25 19:37 ` iains at gcc dot gnu.org
2022-04-26  9:38 ` avi at scylladb dot com
2022-04-26  9:43 ` avi at scylladb dot com
2022-04-26 10:07 ` avi at scylladb dot com
2022-04-28 14:29 ` avi at scylladb dot com
2022-04-28 14:52 ` avi at scylladb dot com
2022-04-28 14:59 ` avi at scylladb dot com
2022-04-28 17:28 ` avi at scylladb dot com [this message]
2022-04-28 18:59 ` iains at gcc dot gnu.org
2022-04-29 19:54 ` iains at gcc dot gnu.org
2022-05-01 14:47 ` avi at scylladb dot com
2022-05-06 11:25 ` avi at scylladb dot com
2022-11-21 13:01 ` avi at scylladb dot com
2022-12-04 14:28 ` avi at scylladb dot com
2022-12-10 12:00 ` iains at gcc dot gnu.org
2022-12-10 12:02 ` iains at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105373-4-Wwb3nYks7p@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).