This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/16536] [3.3/3.4 regression] Incorrect __restrict__ optimization in -O2
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jul 2004 15:50:22 -0000
- Subject: [Bug rtl-optimization/16536] [3.3/3.4 regression] Incorrect __restrict__ optimization in -O2
- References: <20040714132218.16536.jeremy.denise@libertysurf.fr>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-07-14 15:50 -------
Here is something a little more obvious (maybe):
------------------
extern "C" void abort ();
struct S {
float u, dummy;
};
inline S add (const S& a,const S& b)
{ return (S) { a.u+b.u, 0 }; }
void foo(S * __restrict__ v0,
S * __restrict__ v1,
S * __restrict__ v2)
{
// add copy v2 of v0 and v1; write result
// into v0
(*v2) = (*v0);
(*v0) = add(*v2, *v1);
if (v0->u != 2)
abort ();
}
int main()
{
S v0={1}, v1={1}, v2;
foo(&v0,&v1,&v2);
}
----------------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -O2 x.cc ; ./a.out
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -O2 x.cc ; ./a.out
Aborted
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-07-14 15:50:21
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16536