public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16180] New: print iterator+1 = Attempt to take address of value not located in memory.
@ 2013-11-17 13:08 jan.kratochvil at redhat dot com
  2013-11-19 16:10 ` [Bug c++/16180] " tromey at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-11-17 13:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16180

            Bug ID: 16180
           Summary: print iterator+1 = Attempt to take address of value
                    not located in memory.
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: jan.kratochvil at redhat dot com
            Target: x86_64-unknown-linux-gnu

(gdb) b 8
(gdb) r
(gdb) p it
$1 = 1
(gdb) p it+1
Attempt to take address of value not located in memory.
(gdb) p it+longvar1
Attempt to take address of value not located in memory.
(gdb) p it.operator+(longvar1)
Attempt to take address of value not located in memory.
(gdb) p it.'operator+'(longvar1)
Attempt to take address of value not located in memory.
(gdb) _

GNU gdb (GDB) 7.6.50.20131109-cvs


#include <vector>
int main() {
  std::vector<int> vec;
  long longvar1(1);
  vec.push_back(1);
  vec.push_back(2);
  for (std::vector<int>::iterator it=vec.begin();it!=vec.end();it=it+1)
    ++*it;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/16180] print iterator+1 = Attempt to take address of value not located in memory.
  2013-11-17 13:08 [Bug c++/16180] New: print iterator+1 = Attempt to take address of value not located in memory jan.kratochvil at redhat dot com
@ 2013-11-19 16:10 ` tromey at redhat dot com
  2020-05-12 12:27 ` ssbssa at sourceware dot org
  2020-05-12 15:45 ` jan.kratochvil at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at redhat dot com @ 2013-11-19 16:10 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16180

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> ---
Maybe a dup of bug#11606

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/16180] print iterator+1 = Attempt to take address of value not located in memory.
  2013-11-17 13:08 [Bug c++/16180] New: print iterator+1 = Attempt to take address of value not located in memory jan.kratochvil at redhat dot com
  2013-11-19 16:10 ` [Bug c++/16180] " tromey at redhat dot com
@ 2020-05-12 12:27 ` ssbssa at sourceware dot org
  2020-05-12 15:45 ` jan.kratochvil at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2020-05-12 12:27 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16180

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
I need to dereference the iterator, but other than that, I can reproduce this
with gdb 7.8:

(gdb) p it
$1 = {_M_current = 0x362110}
(gdb) p it+1
$2 = {_M_current = 0x362114}
(gdb) p *it
$3 = (int &) @0x362110: 1
(gdb) p *(it+1)
Attempt to take address of value not located in memory.
(gdb) p *(it+longvar1)
Attempt to take address of value not located in memory.

But since 7.10, this works fine:

(gdb) p it
$1 = {_M_current = 0x342110}
(gdb) p it+1
$2 = {_M_current = 0x342114}
(gdb) p *it
$3 = (int &) @0x342110: 1
(gdb) p *(it+1)
$4 = (int &) @0x342114: 2
(gdb) p *(it+longvar1)
$5 = (int &) @0x342114: 2

So I think this can be closed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/16180] print iterator+1 = Attempt to take address of value not located in memory.
  2013-11-17 13:08 [Bug c++/16180] New: print iterator+1 = Attempt to take address of value not located in memory jan.kratochvil at redhat dot com
  2013-11-19 16:10 ` [Bug c++/16180] " tromey at redhat dot com
  2020-05-12 12:27 ` ssbssa at sourceware dot org
@ 2020-05-12 15:45 ` jan.kratochvil at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2020-05-12 15:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16180

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |jan.kratochvil at redhat dot com

--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Verified on: gdb-8.3.50.20190824-30.fc31.x86_64

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-12 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-17 13:08 [Bug c++/16180] New: print iterator+1 = Attempt to take address of value not located in memory jan.kratochvil at redhat dot com
2013-11-19 16:10 ` [Bug c++/16180] " tromey at redhat dot com
2020-05-12 12:27 ` ssbssa at sourceware dot org
2020-05-12 15:45 ` jan.kratochvil at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).