public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tbuyukliev at vmware dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/104238] dwarf DW_AT_const_value causes overflow in readelf
Date: Wed, 26 Jan 2022 16:49:33 +0000	[thread overview]
Message-ID: <bug-104238-4-qPN9JW3nBg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104238-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Todor Buyukliev <tbuyukliev at vmware dot com> ---
> When gcc is emitting the DW_AT_const_value, it doesn't know if it is signed or unsigned, CONST_INT it uses is always signed.
good, so this is as designed.

> That sleb128 value is certainly not too large, it fits into 64-bit signed value
it fits, because it was truncated to fit the 64-bit variable readelf uses
internally.

the bytes in memory are 8080808080808080807f, so in the decoded form bits 64 to
70 inclusive (counting from 1) are 1.

the leb128 encoding doesn't have a way to say how many bits the value has, and
this means that it's as wide as the highest non-zero bit, 70 in this case
(counting from 1).

  parent reply	other threads:[~2022-01-26 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 10:40 [Bug debug/104238] New: " tbuyukliev at vmware dot com
2022-01-26 11:41 ` [Bug debug/104238] " jakub at gcc dot gnu.org
2022-01-26 13:11 ` rguenth at gcc dot gnu.org
2022-01-26 13:43 ` marxin at gcc dot gnu.org
2022-01-26 16:49 ` tbuyukliev at vmware dot com [this message]
2022-01-26 19:14 ` jakub at gcc dot gnu.org
2022-01-26 19:30 ` pinskia 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-104238-4-qPN9JW3nBg@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).