Summary: | wrong result due to -O2 optimization in combination with std::list | ||
---|---|---|---|
Product: | gcc | Reporter: | Sebastian Schmitt <basti> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | bangerth, basti, fang, gcc-bugs, rguenth |
Priority: | P3 | Keywords: | alias, wrong-code |
Version: | 4.1.3 | ||
Target Milestone: | --- | ||
Host: | i486-linux-gnu | Target: | i486-linux-gnu |
Build: | i486-linux-gnu | Known to work: | 3.4.6 4.2.1 4.3.0 |
Known to fail: | 4.1.2 4.1.3 | Last reconfirmed: |
Description
Sebastian Schmitt
2008-02-08 15:05:06 UTC
replacing all doubles types with size_t or int does change nothing. the bug still exists. This is possibly a dup of one of the various alias problems of gcc 4.1. -fno-strict-aliasing is a workaround. One can even omit the helper class sample and directly use a list<size_t >, bug is still there!!! the above mentioned work-around with -fno-strict-aliasing works, but still... makes my kinda nervous about all my codes... Can this be reproduced with gcc 4.2.x or current mainline? Not with this testcase. The bug is not encountered when using the list<> container from the stlport-library instead of the one coming with the compiler. I tried the versions 4.6, 5.0, and 5.1 (debian-etch packages libstlport4.6-dev,libstlport5.0-dev, libstlport5.1-dev) and everything worked fine. Hope that helps, sebastian ps: is there any chance this bug is sorted out any time soon, or should i switch to a different compiler-version alltogether? We should probably admit that we will not fix this bug for GCC 4.1 (there will be no further release off that branch). A workaround is to use -fno-strict-aliasing. Please consider moving to GCC 4.2.x or 4.3.x once it is released. Works with current trunk, 4.1 is no longer maintained. Closing. |