Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cmuratori/48ab8f6a6d78196e1323d4a0796e7732 to your computer and use it in GitHub Desktop.
Save cmuratori/48ab8f6a6d78196e1323d4a0796e7732 to your computer and use it in GitHub Desktop.
Microsoft Visual Studio 2012 Internal Compiler Error
// Put this in a .c file and cl it to cause the internal compiler error. It also crashes as a .cpp, but you have to extern "C" the declarations.
typedef union __m128 {float m128_f32[4];} __m128;
__m128 _mm_load_ps(float const *);
void _mm_store_ps(float *, __m128);
void main(void) {_mm_store_ps(0, _mm_load_ps(0));}
@AndrewPardoe
Copy link

It turns out that your code is missing a decltype in the definition of the __m128 type:

typedef union __declspec(intrin_type) __m128 {float m128_f32[4];} __m128;
extern "C" __m128 _mm_load_ps(float const *);
extern "C" void _mm_store_ps(float *, __m128);
void main() { _mm_store_ps(0, _mm_load_ps(0)); }

If you add __declspec(intrin_type) then it will work as expected. Or just use #include <intrin.h> to get all the definitions loaded for you.

That said, our compiler should never crash on legal or illegal code. We’ll fix that. Thanks for the report!

@cmuratori
Copy link
Author

Yes, we know :) That is where this GIST came from in the first place:

"Today's fun discovery: removing the __declspec's from the definition of __m128 causes MSVC to ICE on any SSE intrinsic."

https://twitter.com/cmuratori/status/751284570297806851

  • Casey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment