This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/21538] g++.dg/opt/temp1.C should be optimized elsewhere
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 May 2005 19:30:31 -0000
- Subject: [Bug middle-end/21538] g++.dg/opt/temp1.C should be optimized elsewhere
- References: <20050512195536.21538.jsm28@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rguenth at gcc dot gnu dot org 2005-05-15 19:30 -------
This optimization should take place in
cp/typeck:build_indirect_ref
where it even tries to do so but fails because it does not strip
NOP_EXPRs before checking for the optimization and also because
same_types_p says const T and T are not equal. Where we have a
MODIFY_EXPR(T, const T) and the const T coming from argument
conversion to operator=(const T&). Maybe carrying out the
actual conversion for creating of the MODIFY_EXPR is not
necessary.
In build_indirect_ref we end up with sth like
(struct TD.1679 &) (struct TD.1679 *) &TARGET_EXPR <D.1693, operator+ (&bD.1689,
(struct TD.1679 &) (struct TD.1679 *) &cD.1690)>
when the only thing we are doing is a conversion from T& to const T&.
Deferred to someone knowing the C++ frontend - this optimization certainly
should take place there.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
Summary|[4.0/4.1 Regression] |g++.dg/opt/temp1.C should be
|g++.dg/opt/temp1.C execution|optimized elsewhere
|test fails |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21538