From: Jakub Jelinek Date: Wed, 11 Apr 2018 10:22:36 +0000 (+0200) Subject: re PR rtl-optimization/85302 (ICE in size_of_loc_descr, at dwarf2out.c:1771 on i686... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5805b08924db448a9f7389ed0b3867c328242f06;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e1d6f8bfbb..ed58fc2afc9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-04-11 Jakub Jelinek + + 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 PR target/85261 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 50a41c56091..0838ebfeb79 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10032,18 +10032,22 @@ maybe_gen_llsym (dw_loc_list_ref 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 representation in *SIZEP. */ 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. */ if (strcmp (curr->begin, curr->end) == 0 && curr->vbegin == curr->vend && !curr->force) return true; + if (!sizep) + return false; + unsigned long size = size_of_locs (curr->expr); /* 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) if (dwarf_version < 5 && size > 0xffff) return true; - if (sizep) - *sizep = size; + *sizep = size; return false; } @@ -10121,7 +10124,9 @@ output_loc_list (dw_loc_list_ref list_head) for (dw_loc_list_ref curr = list_head; curr != NULL; curr = curr->dw_loc_next) { - if (skip_loc_list_entry (curr)) + unsigned long size; + + if (skip_loc_list_entry (curr, &size)) continue; vcount++; @@ -30887,7 +30892,14 @@ index_location_lists (dw_die_ref die) for (curr = list; curr != NULL; curr = curr->dw_loc_next) { /* 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 || skip_loc_list_entry (curr)) continue; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b224f588b3..9f8b16a2023 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-11 Jakub Jelinek + + PR debug/85302 + * g++.dg/debug/dwarf2/pr85302.C: New test. + 2018-04-11 Thomas Preud'homme PR target/85261 diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C new file mode 100644 index 00000000000..97ac302a921 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C @@ -0,0 +1,14 @@ +// 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 (""); +}