Commit 5805b089 by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/85302 (ICE in size_of_loc_descr, at dwarf2out.c:1771 on i686-linux-gnu)

	PR debug/85302
	* dwarf2out.c (skip_loc_list_entry): Don't call size_of_locs if
	SIZEP is NULL.
	(output_loc_list): Pass address of a dummy size variable even in the
	locview handling loop.
	(index_location_lists): Add comment on why skip_loc_list_entry can't
	call size_of_locs.

	* g++.dg/debug/dwarf2/pr85302.C: New test.

From-SVN: r259311
parent 60d1915f
2018-04-11 Jakub Jelinek <jakub@redhat.com>
PR debug/85302
* dwarf2out.c (skip_loc_list_entry): Don't call size_of_locs if
SIZEP is NULL.
(output_loc_list): Pass address of a dummy size variable even in the
locview handling loop.
(index_location_lists): Add comment on why skip_loc_list_entry can't
call size_of_locs.
2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com> 2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR target/85261 PR target/85261
......
...@@ -10032,18 +10032,22 @@ maybe_gen_llsym (dw_loc_list_ref list) ...@@ -10032,18 +10032,22 @@ maybe_gen_llsym (dw_loc_list_ref list)
gen_llsym (list); gen_llsym (list);
} }
/* Determine whether or not to skip loc_list entry CURR. If we're not /* Determine whether or not to skip loc_list entry CURR. If SIZEP is
NULL, don't consider size of the location expression. If we're not
to skip it, and SIZEP is non-null, store the size of CURR->expr's to skip it, and SIZEP is non-null, store the size of CURR->expr's
representation in *SIZEP. */ representation in *SIZEP. */
static bool static bool
skip_loc_list_entry (dw_loc_list_ref curr, unsigned long *sizep = 0) skip_loc_list_entry (dw_loc_list_ref curr, unsigned long *sizep = NULL)
{ {
/* Don't output an entry that starts and ends at the same address. */ /* Don't output an entry that starts and ends at the same address. */
if (strcmp (curr->begin, curr->end) == 0 if (strcmp (curr->begin, curr->end) == 0
&& curr->vbegin == curr->vend && !curr->force) && curr->vbegin == curr->vend && !curr->force)
return true; return true;
if (!sizep)
return false;
unsigned long size = size_of_locs (curr->expr); unsigned long size = size_of_locs (curr->expr);
/* If the expression is too large, drop it on the floor. We could /* If the expression is too large, drop it on the floor. We could
...@@ -10053,8 +10057,7 @@ skip_loc_list_entry (dw_loc_list_ref curr, unsigned long *sizep = 0) ...@@ -10053,8 +10057,7 @@ skip_loc_list_entry (dw_loc_list_ref curr, unsigned long *sizep = 0)
if (dwarf_version < 5 && size > 0xffff) if (dwarf_version < 5 && size > 0xffff)
return true; return true;
if (sizep) *sizep = size;
*sizep = size;
return false; return false;
} }
...@@ -10121,7 +10124,9 @@ output_loc_list (dw_loc_list_ref list_head) ...@@ -10121,7 +10124,9 @@ output_loc_list (dw_loc_list_ref list_head)
for (dw_loc_list_ref curr = list_head; curr != NULL; for (dw_loc_list_ref curr = list_head; curr != NULL;
curr = curr->dw_loc_next) curr = curr->dw_loc_next)
{ {
if (skip_loc_list_entry (curr)) unsigned long size;
if (skip_loc_list_entry (curr, &size))
continue; continue;
vcount++; vcount++;
...@@ -30887,7 +30892,14 @@ index_location_lists (dw_die_ref die) ...@@ -30887,7 +30892,14 @@ index_location_lists (dw_die_ref die)
for (curr = list; curr != NULL; curr = curr->dw_loc_next) for (curr = list; curr != NULL; curr = curr->dw_loc_next)
{ {
/* Don't index an entry that has already been indexed /* Don't index an entry that has already been indexed
or won't be output. */ or won't be output. Make sure skip_loc_list_entry doesn't
call size_of_locs, because that might cause circular dependency,
index_location_lists requiring address table indexes to be
computed, but adding new indexes through add_addr_table_entry
and address table index computation requiring no new additions
to the hash table. In the rare case of DWARF[234] >= 64KB
location expression, we'll just waste unused address table entry
for it. */
if (curr->begin_entry != NULL if (curr->begin_entry != NULL
|| skip_loc_list_entry (curr)) || skip_loc_list_entry (curr))
continue; continue;
......
2018-04-11 Jakub Jelinek <jakub@redhat.com>
PR debug/85302
* g++.dg/debug/dwarf2/pr85302.C: New test.
2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com> 2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR target/85261 PR target/85261
......
// PR debug/85302
// { dg-do compile }
// { dg-options "-std=c++11 -gsplit-dwarf -O1" }
// { dg-additional-options "-fPIE" { target pie } }
struct A { const char *b; A (const char *c) : b(c) {} };
struct B { void foo (A); };
B e;
void
bar ()
{
e.foo ("");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment