This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30088] [4.1/4.2 Regression] Unexpected compilation results: -O1 vs. -O1 -fstrict-aliasing
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Dec 2007 16:38:00 -0000
- Subject: [Bug tree-optimization/30088] [4.1/4.2 Regression] Unexpected compilation results: -O1 vs. -O1 -fstrict-aliasing
- References: <bug-30088-13701@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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