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

--- Comment #3 from Rafael Avila de Espindola <rafael at espindo dot la> ---
(In reply to Jonathan Wakely from comment #2)
> Rafael, I'm unable to reproduce this with unordered containers. Do you have
> a testcase?

I was able to reproduce it with 2 files:

$ cat test.cc
#include <unordered_map>
void foo(std::unordered_map<int, int> &map);
int main() {
  std::unordered_map<int, int> map;
  map[42] = 1;
  foo(map);
  return 0;
}
$ cat test2.cc
#include <unordered_map>
#include <stdio.h>
void foo(std::unordered_map<int, int> &map) {
  auto it = map.begin();
  printf("%d\n", *it);
}
$ g++ test.cc test2.cc -o t -g
$ /usr/bin/gdb -q -ex "b printf" -ex r -ex bt ./t
Reading symbols from ./t...
Breakpoint 1 at 0x204b10
Starting program: /home/espindola/scylla/t
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments

Breakpoint 1, __printf (format=0x20081b "%d\n") at printf.c:28
28      {
#0  __printf (format=0x20081b "%d\n") at printf.c:28
#1  0x000000000020494a in foo (Traceback (most recent call last):
  File "/lib64/../share/gcc-9/python/libstdcxx/v6/printers.py", line 957, in
children
    data = self.flatten (imap (self.format_one, StdHashtableIterator
(self.hashtable())))
  File "/lib64/../share/gcc-9/python/libstdcxx/v6/printers.py", line 880, in
__init__
    self.node_type = find_type(hash.type, '__node_type').pointer()
  File "/lib64/../share/gcc-9/python/libstdcxx/v6/printers.py", line 97, in
find_type
    field = typ.fields()[0]
IndexError: list index out of range
map=
std::unordered_map with 1 element) at test2.cc:5
#2  0x0000000000203017 in main () at test.cc:6

Reply via email to