This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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++/14862] New: Invalid code generated (possible when reordering instructions)


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


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