diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-04-11 12:22:36 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-04-11 12:22:36 +0200 |
commit | 5805b08924db448a9f7389ed0b3867c328242f06 (patch) | |
tree | 97f7ee062dd40c3ac2c4c1e17cf29fee6ca1214f /gcc | |
parent | 60d1915f9a3bbc2b3cc9d5eec72404d9b7180ad8 (diff) | |
download | gcc-5805b08924db448a9f7389ed0b3867c328242f06.zip gcc-5805b08924db448a9f7389ed0b3867c328242f06.tar.gz gcc-5805b08924db448a9f7389ed0b3867c328242f06.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C | 14 |
4 files changed, 47 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e1d6f8..ed58fc2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +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> PR target/85261 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 50a41c5..0838ebf 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 9b224f5..9f8b16a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> 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 0000000..97ac302 --- /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 (""); +} |