STL unordered_map crashes with __m128 values

I was tracking the error in using __m128 (SSE vector) as the value in std :: unordered_map. This causes a segmentation error at runtime using mingw32 g ++ 4.7.2.

See the example below. Is there a reason why this should fail? Or maybe a workaround? (I tried to wrap the value in the class, but that didn't 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

+5
source share
2 answers

++ . x86 ABI 8, __m128 16 , . x86_64 ABI 16, __m128 ( __m256 32- ).

. , " ": http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3396.htm

, , aligned_alloc (C11), posix_memalign (unix), _aligned_malloc (Microsoft) ..

+2

:

ABI, __m128 ?

new __m128? .. 16 .

+3

All Articles