public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/99562] Invalid debug info: objdump: Warning: Location list starting at offset 0x9c3 is not terminated.
Date: Fri, 12 Mar 2021 16:31:56 +0000	[thread overview]
Message-ID: <bug-99562-4-ihQIflPkRs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99562-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Caused by the (IMHO incorrect) PR66728 changes.
We have 2 spots that fill in dw_loc_oprnd?.v.val_wide:
          mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_const_type), 0, 0);
          mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.die = type_die;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.external = 0;
          mem_loc_result->dw_loc_oprnd2.val_class
            = dw_val_class_wide_int;
          mem_loc_result->dw_loc_oprnd2.v.val_wide = ggc_alloc<wide_int> ();
          *mem_loc_result->dw_loc_oprnd2.v.val_wide = rtx_mode_t (rtl, mode);
and
          loc_result = new_loc_descr (DW_OP_implicit_value,
                                      GET_MODE_SIZE (int_mode), 0);
          loc_result->dw_loc_oprnd2.val_class = dw_val_class_wide_int;
          loc_result->dw_loc_oprnd2.v.val_wide = ggc_alloc<wide_int> ();
          *loc_result->dw_loc_oprnd2.v.val_wide = rtx_mode_t (rtl, int_mode);
and 3 callers of add_AT_wide:
    case CONST_WIDE_INT:
      {
        wide_int w1 = rtx_mode_t (rtl, MAX_MODE_INT);
        unsigned int prec = MIN (wi::min_precision (w1, UNSIGNED),
                                 (unsigned int)CONST_WIDE_INT_NUNITS (rtl) *
HOST_BITS_PER_WIDE_INT);
        wide_int w = wi::zext (w1, prec);
        add_AT_wide (die, DW_AT_const_value, w);
      }
and
      else if (dwarf_version >= 5
               && TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (value))) == 128)
        /* Otherwise represent the bound as an unsigned value with
           the precision of its type.  The precision and signedness
           of the type will be necessary to re-interpret it
           unambiguously.  */
        add_AT_wide (die, attr, wi::to_wide (value));
and
          else
            /* Enumeration constants may be wider than HOST_WIDE_INT.  Handle
               that here.  TODO: This should be re-worked to use correct
               signed/unsigned double tags for all cases.  */
            add_AT_wide (enum_die, DW_AT_const_value, wi::to_wide (value));

Now, I think the PR66728 changes fixed the first add_AT_wide case (iff GET_MODE
(rtl) is VOIDmode only) but at the same time broke all the other 4 cases, which
really expect that the constants in the debug info will have the expected
length.  Some cases like the DW_OP_implicit_value we're hitting here explicitly
on the producer size, as it fills in the size of the constant.

  parent reply	other threads:[~2021-03-12 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 15:40 [Bug debug/99562] New: " marxin at gcc dot gnu.org
2021-03-12 15:47 ` [Bug debug/99562] " marxin at gcc dot gnu.org
2021-03-12 15:48 ` jakub at gcc dot gnu.org
2021-03-12 16:31 ` jakub at gcc dot gnu.org [this message]
2021-03-12 16:44 ` jakub at gcc dot gnu.org
2021-03-22  7:53 ` cvs-commit 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-99562-4-ihQIflPkRs@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).