I tracked a bug to the use of a __m128 (SSE vector) as a value in a std::unordered_map. This causes a runtime segmentation fault with mingw32 g++4.7.2.
Please see the example below. Is there any reason why this should fail? Or, might there be a workaround? (I tried wrapping the value in a class but it did not help.) Thanks.
#include <unordered_map>
#include <xmmintrin.h> // __m128
#include <iostream>
int main()
{
std::unordered_map<int,__m128> m;
std::cerr << "still ok\n";
m[0] = __m128();
std::cerr << "crash in previous statement\n";
return 0;
}
Compilation settings: g++ -march=native -std=c++11
There are 2 issues regarding alignment:
Does the ABI ensure that __m128
variables are always aligned on the stack?
Does the global new
operator return memory suitably aligned for the __m128
type? i.e., returns memory with a 16-byte alignment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With