public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "hluaw at connect dot ust.hk" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30319] New: GDB shows "Incompatible DWARF Stack" when it's actually compatible
Date: Thu, 06 Apr 2023 06:13:43 +0000	[thread overview]
Message-ID: <bug-30319-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30319

            Bug ID: 30319
           Summary: GDB shows "Incompatible DWARF Stack" when it's
                    actually compatible
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hluaw at connect dot ust.hk
  Target Milestone: ---

Given the following code:
#include "stdint.h"
int a, b = 9067;
volatile uint16_t *c = (volatile uint16_t*)&b;
int *d = &a;
int func_1() {
  uint16_t e[7][2][8];
  uint32_t f = 37455;
  int32_t l_146;
  a = 0;
  l_146 = *c * f;
  *d = e[3][1][5];
  return l_146;
}
int main() { func_1(); return 0; }

Compiled with clang 15.0.7 and -O1 -g.

For l_146, the following DWARF is generated.

(gdb) info addr l_146
Symbol "l_146" is multi-location:
  Range 0x555555554674-0x55555555467b: a complex DWARF expression:
     0: DW_OP_breg0 0 [$rax]
     2: DW_OP_constu 65535
     6: DW_OP_and
     7: DW_OP_convert<DW_ATE_unsigned_16 [0x27]>
    12: DW_OP_convert<DW_ATE_unsigned_32 [0x2b]>
    17: DW_OP_constu 37455
    21: DW_OP_mul
    22: DW_OP_stack_value
(gdb) p l_146
Incompatible types on DWARF stack

GDB complaining that this DWARF expression is invalid since on DW_OP_mul, but
this DWARF is in fact valid since it performs a explicit conversion, and
DW_OP_constu 37455 is automatically unsigned.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-04-06  6:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06  6:13 hluaw at connect dot ust.hk [this message]
2023-04-13 14:39 ` [Bug gdb/30319] " tromey at sourceware dot 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-30319-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).