This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/10823] [3.3/3.4 regression] wrong code after first cse pass
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jun 2003 15:14:47 -0000
- Subject: [Bug optimization/10823] [3.3/3.4 regression] wrong code after first cse pass
- References: <20030516165601.10823.gawrilow@math.tu-berlin.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10823
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From bangerth at dealii dot org 2003-06-25 15:14 -------
Your code is faulty: in this function
LV get() const {
return op(*static_cast<const ITP&>(*this), *second);
}
the first operand to op.operator() is constructed by calling
Uop::result_type Uev::operator* () const {
return op(*p);
}
with result_type being of type RV. Thus, it's returned object is a
temporary. However, op.Bop::operator() takes a reference and passes
it on. This doesn't work.
I could make the code work as expected also in the presence of
strict aliasing, by replacing the first function above (in the
original code) by
LV get() const {
static RV rv = *static_cast<const ITP&>(*this);
return op(rv, *second);
}
I attach my last reduced testcase to the PR later.
W.