public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16675] New: invalid value of sizeof or reference in gdb
@ 2014-03-07 23:42 vladi_ian at yahoo dot com
  2014-03-07 23:44 ` [Bug c++/16675] invalid value of sizeof of " vladi_ian at yahoo dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vladi_ian at yahoo dot com @ 2014-03-07 23:42 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16675
           Summary: invalid value of sizeof or reference in gdb
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: vladi_ian at yahoo dot com

problem with printing size of reference in gdb. The output is the size of
pointer, not the size of type.
In the next program
#include <iostream>
int main()
{
    typedef unsigned char a4[4];
    a4 p1;
    a4& p2 = p1;
    std::cout<<sizeof(p2);
    return 0;
}

Compile, start gdb and put breakpoint on return. If you type p sizeof(p2), gdb
will print 8 instead of 4 which will be printed if you start the program. If
you write in gdb p sizeof(*p2), the output is 4 (the size of array). I think
this is because gdb treats p2 as pointer(reference is implemented behind the
scene as pointer).

Tested with compilers GCC 4.8.2 and Clang 4.3 on GDB 7.7 linux arch., ubuntu
13.10,

There are also examples in
http://stackoverflow.com/questions/22255860/sizeof-reference-to-array-in-gdb?noredirect=1#comment33814516_22255860

-- 
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++/16675] invalid value of sizeof of reference in gdb
  2014-03-07 23:42 [Bug c++/16675] New: invalid value of sizeof or reference in gdb vladi_ian at yahoo dot com
@ 2014-03-07 23:44 ` vladi_ian at yahoo dot com
  2014-03-21 18:33 ` keiths at redhat dot com
  2014-04-14 18:18 ` keiths at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: vladi_ian at yahoo dot com @ 2014-03-07 23:44 UTC (permalink / raw)
  To: gdb-prs

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

Vladimir Yanakiev <vladi_ian at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|invalid value of sizeof or  |invalid value of sizeof of
                   |reference in gdb            |reference in gdb

-- 
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++/16675] invalid value of sizeof of reference in gdb
  2014-03-07 23:42 [Bug c++/16675] New: invalid value of sizeof or reference in gdb vladi_ian at yahoo dot com
  2014-03-07 23:44 ` [Bug c++/16675] invalid value of sizeof of " vladi_ian at yahoo dot com
@ 2014-03-21 18:33 ` keiths at redhat dot com
  2014-04-14 18:18 ` keiths at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: keiths at redhat dot com @ 2014-03-21 18:33 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com
           Assignee|unassigned at sourceware dot org   |keiths at redhat dot com

--- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
Thank you for the report. I've submitted the following patch for approval:
https://sourceware.org/ml/gdb-patches/2014-03/msg00541.html

-- 
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++/16675] invalid value of sizeof of reference in gdb
  2014-03-07 23:42 [Bug c++/16675] New: invalid value of sizeof or reference in gdb vladi_ian at yahoo dot com
  2014-03-07 23:44 ` [Bug c++/16675] invalid value of sizeof of " vladi_ian at yahoo dot com
  2014-03-21 18:33 ` keiths at redhat dot com
@ 2014-04-14 18:18 ` keiths at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: keiths at redhat dot com @ 2014-04-14 18:18 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.8

--- Comment #2 from Keith Seitz <keiths at redhat dot com> ---
(In reply to Keith Seitz from comment #1)
> Thank you for the report. I've submitted the following patch for approval:
> https://sourceware.org/ml/gdb-patches/2014-03/msg00541.html

Patches approved and committed.

https://sourceware.org/ml/gdb-patches/2014-04/msg00225.html

-- 
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:[~2014-04-14 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07 23:42 [Bug c++/16675] New: invalid value of sizeof or reference in gdb vladi_ian at yahoo dot com
2014-03-07 23:44 ` [Bug c++/16675] invalid value of sizeof of " vladi_ian at yahoo dot com
2014-03-21 18:33 ` keiths at redhat dot com
2014-04-14 18:18 ` keiths 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).