http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51392
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-04
15:50:40 UTC ---
__attribute__((__const__))
Vector3f pie_SurfaceNormal3fv(Vector3f a, Vector3f b)
{
return Vector3f(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x);
}
I think it is illegal to use the const attribute when the C++ frontend
may elide the return value copy to being passed by invisible reference.
That way the middle-end sees a store to global memory which is a side-effect
that the const attribute does not allow (similar for pure btw.).
Note that the Vector3f() constructors are not const either but they are
both called from pie_SurfaceNormal3fv.