public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Rohr, Stephan" <stephan.rohr@intel.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Issue in dwarf2/expr.c
Date: Wed, 13 Apr 2022 16:57:51 +0000	[thread overview]
Message-ID: <DM6PR11MB456405A1FA95FA5498049AC093EC9@DM6PR11MB4564.namprd11.prod.outlook.com> (raw)

Hi all,

I came across a bug in dwarf2/expr.c:177 in function  rw_pieced_value. when reading a pieced value described by DW_OP_piece or DW_OP_bit_piece.

      if (value_type (v) != value_enclosing_type (v))
                internal_error (__FILE__, __LINE__,
                                                _("Should not be able to create a lazy value with "
                                                  "an enclosing type"));

This check can easily be triggered when casting a variable with location described by DW_OP_piece or DW_OP_bit_piece.

A minimal reproducer can be found in gdb/testsuite/gdb.dwarf2/shortpiece.exp, e.g. casting s1 to an array type triggers the error

p (short []) s1

I currently struggle to understand the reasoning for this check. I could think of changing this to

if (TYPE_LENGTH(value_type (v)) > TYPE_LENGTH( value_enclosing_type (v)))
to support the cast operation.

But in general, I'm not sure why this check is needed at all.

I appreciate your feedback.


Best
stephan


             reply	other threads:[~2022-04-13 16:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 16:57 Rohr, Stephan [this message]
2022-04-14 13:51 ` Andreas Arnez
2022-04-15 20:24   ` Tom Tromey
2022-04-19  6:28     ` Rohr, Stephan

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=DM6PR11MB456405A1FA95FA5498049AC093EC9@DM6PR11MB4564.namprd11.prod.outlook.com \
    --to=stephan.rohr@intel.com \
    --cc=gdb@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).