This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/84456] [8 regression] gcc.dg/guality/pr49888.c fail


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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, the bug is that GCC 7's dw_loc_list tail:
  /* Try to avoid the overhead of a location list emitting a location
     expression instead, but only if we didn't have more than one
     location entry in the first place.  If some entries were not
     representable, we don't want to pretend a single entry that was
     applies to the entire scope in which the variable is
     available.  */
  if (list && loc_list->first->next)
    gen_llsym (list);

has been replaced with:
  /* Try to avoid the overhead of a location list emitting a location
     expression instead, but only if we didn't have more than one
     location entry in the first place.  If some entries were not
     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);

where maybe_gen_llsym has:
  if (!list || (!list->dw_loc_next && !loc_list_has_views (list)))
    return;

  gen_llsym (list);

That is not really equivalent; it is equivalent in the other spot, where it
used to be:
  if (list && list->dw_loc_next)
    gen_llsym (list);
and now is:
  maybe_gen_llsym (list);
but in the first case, we were calling gen_llsym even when list &&
list->dw_loc_next == NULL, intentionally so, that means we got some location
note that would start the range and then another one that resets the range.

The following patch fixes this for me:
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;
 }

The maybe_gen_llsym will cover the case when -gvariable-location-views and
list && list->dw_loc_next == NULL && loc_list->first->next == NULL and the
single entry list has some non-zero view.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]