This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14862] New: Invalid code generated (possible when reordering instructions)
- From: "cxl at ntllib dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Apr 2004 10:42:30 -0000
- Subject: [Bug c++/14862] New: Invalid code generated (possible when reordering instructions)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc (GCC) 3.3.3 (mingw special)
gcc (GCC) 3.3.1 (mingw special 20030804-1)
This code produces invalid output:
#include <iostream>
struct Bar {
int x;
int y;
};
struct Foo {
int a;
int b;
operator Bar() const { return *(Bar *)this; }
};
int main(int argc, const char **argv)
{
Foo f;
f.a = 12345;
f.b = 54321;
Bar b = f;
std::cout << b.x << ", " << b.y << '\n';
return 0;
}
when compiled with options
-c -O2 -ffunction-sections
--
Summary: Invalid code generated (possible when reordering
instructions)
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cxl at ntllib dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14862