This is a problem in gcc's default debug format. It works fine with -gstabs.
struct X
{
bool x;
double d;
};
int main()
{
X x;
x.d = 42.0;
}
When debugging with gdb, x.d will contain something wrong, (often something
like 5.301466631257326e-315). If you change the bool to another type or
remove that variable completely, the results are correct. If you move the bool
to the end of the structure, the results are also correct.
This bug does not affect the execution of the program.
I guess it's something to do with how gcc writes debug info for the size of a
bool in the structure, possibly related to packing.
I'm also able to reproduce this on gcc 3.3.4.
--
Summary: debug info wrong for doubles followed by bools
Product: gcc
Version: 3.3.6
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: charles at kde dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: gcc version 3.3.6 (Debian 1:3.3.6-7)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22318