This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12106] New: x.bar is 1, but "p x.bar" says x.bar is-147973464


http://sourceware.org/bugzilla/show_bug.cgi?id=12106

           Summary: x.bar is 1, but "p x.bar" says x.bar is -147973464
           Product: gdb
           Version: archer
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: safinaskar@mail.ru


I created x.cpp:

class foo
{
public:
    int bar;
    ~foo(){};
};

foo f()
{
    foo x;
    x.bar = 1;
    x.bar = x.bar;
    return x;
};

int main()
{
    f();
};

Then I compiled this and start gdb:

# g++ -g x.cpp
# gdb a.out
GNU gdb (GDB) 7.2.50.20101009
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/Desktop/a.out...done.
(gdb) br x.cpp:11
Breakpoint 1 at 0x40058b: file x.cpp, line 11.
(gdb) r
Starting program: /root/Desktop/a.out 

Breakpoint 1, f () at x.cpp:11
11              x.bar = 1;
(gdb) n
12              x.bar = x.bar;
(gdb) p x.bar
$1 = -147973464

I use Debian Squeeze GNU/Linux, linux kernel 2.6.32-5, amd64, gcc and g++
4:4.4.4-2 from my repository

This bug was when I used gdb 7.0.1-2+b1 from my repository and when I used gdb
7.2.50.20101009 from ftp://sourceware.org/pub/gdb/snapshots/, too.

I'm Russian. So please speak with me in Russian or simple English.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]