Jump to content
  • Advertisement
Sign in to follow this  

C++ SSE segfault

This topic is 4418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm trying to write simple 3d vector class using SSE. Everything works fine when using static objects but anytime I try using dynamic allocation it crashes with segfault. I suppose it's problem with memory alignment but I can't figure out what is wrong. This code crashes at v.m = _mm_set1_ps(0.0f); #ifdef __SSE__ #include <xmmintrin.h> #else #error NO SSE #endif union sse4{ __m128 m; struct{ float x,y,z,w; }; float f[4]; }; class vector3d{ sse4 v; public: vector3d(){ v.m = _mm_set1_ps(0.0f); } }; int main(){ vector3d *test[100]; for(unsigned int t = 0; t < 100; t++){ test[t] = new vector3d; } return 0; } g++ -ggdb -msse -mfpmath=sse code.cpp -o code Does anybody have a solution?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!