[Bug c++/39365] New: ++ operator with volatile bool increments
foo at mailinator dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 4 19:35:00 GMT 2009
This program:
extern "C" void abort();
typedef volatile bool my_bool;
int main()
{
my_bool b = false;
int i;
b++;
b++;
i = b;
if (i != 1)
abort ();
return 0;
}
calls abort(), because GCC is generating an increment for the '++' operator
rather than setting the value to true, and so 'i' becomes 2 not 1.
This is an exact duplicate of bug #29295, except that I've added the keyword
"volatile" on line 2, and this program still aborts on 4.2.4 and 4.3.2, even
though bug #29295 is supposedly fixed in those versions.
--
Summary: ++ operator with volatile bool increments
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: foo at mailinator dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39365
More information about the Gcc-bugs
mailing list