I created x.cpp:
x.bar = 1;
x.bar = x.bar;
Then I compiled this and start gdb:
# g++ -g x.cpp
# gdb a.out
GNU gdb (GDB) 18.104.22.16801009
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:
Reading symbols from /root/Desktop/a.out...done.
(gdb) br x.cpp:11
Breakpoint 1 at 0x40058b: file x.cpp, line 11.
Starting program: /root/Desktop/a.out
Breakpoint 1, f () at x.cpp:11
11 x.bar = 1;
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 22.214.171.12401009 from ftp://sourceware.org/pub/gdb/snapshots/, too.
I'm Russian. So please speak with me in Russian or simple English.
This is a g++ bug. Closing as dup of the gdb tracker.
*** This bug has been marked as a duplicate of bug 11836 ***