* [PATCH] Fix dwarf2out regression introduced with LVUs (PR debug/84456)
@ 2018-03-08 18:35 Jakub Jelinek
2018-03-08 21:32 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-03-08 18:35 UTC (permalink / raw)
To: Jason Merrill, Jeff Law, Alexandre Oliva; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix dwarf2out regression introduced with LVUs (PR debug/84456)
2018-03-08 18:35 [PATCH] Fix dwarf2out regression introduced with LVUs (PR debug/84456) Jakub Jelinek
@ 2018-03-08 21:32 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-03-08 21:32 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jeff Law, Alexandre Oliva, gcc-patches List
OK.
On Thu, Mar 8, 2018 at 1:14 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-08 21:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 18:35 [PATCH] Fix dwarf2out regression introduced with LVUs (PR debug/84456) Jakub Jelinek
2018-03-08 21:32 ` Jason Merrill
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).