Re: [eigen] alignment question |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
On Tue, Jan 27, 2015 at 2:25 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:This code is fine by itself.It does rely on a nontrivial assumption: that stack frames are 16-byte aligned. Indeed, the alignment for Vector4f is 16 bytes, and you are placing Vector4f's on the stack in two places: as the return value of ToPoint, and for the local variable v in the third snippet. However, that assumption --- that stack frames are 16-byte aligned --- should be true. What compiler and OS are we talking about?I use clang from xcode on mac os x yosemite.Can you share a compilable testcase?I will prepare it tonight. I am not sure it is because of this, but I don't see other options.Benoit2015-01-27 5:04 GMT-05:00 Sylvain Pointeau <sylvain.pointeau@xxxxxxxxx>:Dear all,I currently migrate my application to use Vector4f instead of Vector3f to benefit the vectorisation..However I face an alignment error at runtime. (I use the latest clang from xcode on mac os x)Vector4f toPoint(const Vector4f &v) {return Vector4f( v.x(), v.y(), v.z(), 1 );}void process( const Vector4f &v ) {// do process my vector}is there an issue with the alignment doing the following?Vector4f v (1,3,4,0);process( toPoint(v) );Please let me know, I have the suspicion that the error comes from there, I wonder if I am right.Best regards,Sylvain
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |