public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>, Jeff Law <law@redhat.com>,
	       Alexandre Oliva <aoliva@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix dwarf2out regression introduced with LVUs (PR debug/84456)
Date: Thu, 08 Mar 2018 18:35:00 -0000	[thread overview]
Message-ID: <20180308181445.GW5867@tucnak> (raw)

Hi!

GCC 7 and earlier had in this spot
  if (list && loc_list->first->next)
    gen_llsym (list);
where we wanted to force loclist if we've seen more than one
NOTE_INSN_VAR_LOCATION for the decl, which means it is not possible to use
a block form DW_AT_location.

Alex has changed this to maybe_gen_llsym (list) call, which does:
  if (!list || (!list->dw_loc_next && !loc_list_has_views (list)))
    return;
   
  gen_llsym (list);
This matches what the other caller of gen_llsym did:
  if (list && list->dw_loc_next)
    gen_llsym (list);
but not the dw_loc_list spot.  The difference between the two is
(when -gno-variable-location-views) that maybe_gen_llsym will not force
loclist form if we transform 2+ NOTE_INSN_VAR_LOCATION notes into a single
defined location expression, which can happen e.g. when the first
note is some usable location and the second one is <optimized away>.
In that case we must use loclist to force the variable to be <optimized away>
in the second part of the function, because the first DWARF expression would
give wrong results there.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2018-03-08  Jakub Jelinek  <jakub@redhat.com>

	PR debug/84456
	* dwarf2out.c (dw_loc_list): If list && loc_list->first->next, call
	gen_llsym, otherwise call maybe_gen_llsym.

--- gcc/dwarf2out.c.jj	2018-03-02 00:15:54.704780976 +0100
+++ gcc/dwarf2out.c	2018-03-08 12:54:01.794054675 +0100
@@ -17076,7 +17076,10 @@ dw_loc_list (var_loc_list *loc_list, tre
      representable, we don't want to pretend a single entry that was
      applies to the entire scope in which the variable is
      available.  */
-  maybe_gen_llsym (list);
+  if (list && loc_list->first->next)
+    gen_llsym (list);
+  else
+    maybe_gen_llsym (list);
 
   return list;
 }

	Jakub

             reply	other threads:[~2018-03-08 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08 18:35 Jakub Jelinek [this message]
2018-03-08 21:32 ` Jason Merrill

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=20180308181445.GW5867@tucnak \
    --to=jakub@redhat.com \
    --cc=aoliva@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=law@redhat.com \
    /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).