http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59170

            Bug ID: 59170
           Summary: pretty printers: end iterator invalid pointer
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
                CC: pmuldoon at redhat dot com, tromey at redhat dot com
            Target: x86_64-unknown-linux-gnu

end iterator points nowhere, it must not be dereferenced by GDB.

(gdb) l
1    #include <vector>
2    int main() {
3      std::vector<int> vec;
4      vec.push_back(1);
5      std::vector<int>::iterator begin=vec.begin();
6      std::vector<int>::iterator end=vec.end();
7      return 0;
8    }
(gdb) b 7
(gdb) r
(gdb) p begin
$2 = 1
(gdb) p end
$1 = 215
     ^^^ random value, and primarily it is not clear it is the end iterator.

And a different Bug: Couldn't it rather show position in the container for
std::random_access_iterator_tag iterators?  That would be more useful.

Reply via email to