------- Comment #16 from reichelt at gcc dot gnu dot org 2007-12-26 16:37 ------- The following reduced testcase (which should return 0) returns 1 on the 4.1 branch and 4.2 branch when compiled with "-O -fstrict-aliasing" or "-O2" on i686-pc-linux-gnu:
======================================================= #include <string> struct A { float x, y; A() : x(), y() {} float& foo(const int& i) { return i ? x : y; } }; int main() { if (!"") return 1; A a; if (!std::string("").compare(std::string(""))) a.foo(0) = 1; else if (std::string("").compare(std::string(""))) std::string("").compare(std::string("")); return !a.y; } ======================================================= -- reichelt at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[4.1/4.2 Regression] |[4.1/4.2 Regression] |Unexpected compilation |Unexpected compilation |results: -O1 vs. -O2 |results: -O1 vs. -O1 - | |fstrict-aliasing http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30088