public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "alves.ped at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/101378] Negative DW_AT_data_member_location
Date: Fri, 09 Jul 2021 14:50:48 +0000	[thread overview]
Message-ID: <bug-101378-4-1Mpn41ohNq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101378-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Pedro Alves <alves.ped at gmail dot com> ---
BTW, I found it curious that empty2 and empty3 get their own addresses, even at
run time, when they could have all been squashed to the same address.  I.e.,
e.g., this ends up with sizeof == 3, when it could have been 1, I believe:

 struct Empty {};

 struct S
 {
   [[no_unique_address]] Empty empty1;
   [[no_unique_address]] Empty empty2;
   [[no_unique_address]] Empty empty3;
 };

Clang also gives empty2 and empty3 unique addresses and sizeof(S)==3.

ABI compatibility could prevent changing this, of course.

Clang also gets the DWARF right, BTW.  For the example above:

 <2><48>: Abbrev Number: 4 (DW_TAG_member)
    <49>   DW_AT_name        : (indirect string, offset: 0x55): empty1
...
    <53>   DW_AT_data_member_location: 0
 <2><54>: Abbrev Number: 4 (DW_TAG_member)
    <55>   DW_AT_name        : (indirect string, offset: 0x62): empty2
...
    <5f>   DW_AT_data_member_location: 1
 <2><60>: Abbrev Number: 4 (DW_TAG_member)
    <61>   DW_AT_name        : (indirect string, offset: 0x69): empty3
...
    <6b>   DW_AT_data_member_location: 2

  parent reply	other threads:[~2021-07-09 14:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 14:28 [Bug debug/101378] New: " simon.marchi at polymtl dot ca
2021-07-08 17:15 ` [Bug debug/101378] " simon.marchi at polymtl dot ca
2021-07-09 14:38 ` alves.ped at gmail dot com
2021-07-09 14:50 ` alves.ped at gmail dot com [this message]
2021-11-09 13:24 ` redi at gcc dot gnu.org
2021-11-09 13:34 ` redi at gcc dot gnu.org
2021-11-09 14:21 ` rguenth at gcc dot gnu.org
2021-11-09 14:24 ` jakub at gcc dot gnu.org
2021-11-09 14:31 ` pedro at palves dot net
2021-11-09 14:49 ` pedro at palves dot net
2021-11-09 16:46 ` pedro at palves dot net
2021-11-11  9:16 ` cvs-commit at gcc dot gnu.org
2021-11-29  8:49 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:21 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:23 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` jakub 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-101378-4-1Mpn41ohNq@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).