对于某些 Windows 7 用户,我有一个 C++ 应用程序在启动时崩溃。我无法在我自己的机器上重现该错误,但使用 breakpad 生成了一个 .dmp 文件,这表明代码因初始化静态 std::vector 数组的“非法指令”而崩溃。这可能意味着什么?
例外:
Unhandled exception at 0x000000013F121362 (myApp.exe) in myApp.exe.4328.dmp: 0xC000001D:
Illegal Instruction.myApp.exe! dynamic initializer for Keyboard::key_freqs_() Line 11 C++
拆卸:
const std::vector<double> Keyboard::key_freqs_ = std::vector<double>({
**Crashed here->** 000000013F121362 vmovaps ymm0,ymmword ptr [__ymm@404059fbe76c8b44403ede353f7ced91403d228f5c28f5c3403b800000000000 (01408B7DE0h)]
000000013F12136A movzx r9d,byte ptr [rsp+20h]
000000013F121370 lea r8,[rbp+1F0h]
000000013F121377 vmovups ymmword ptr [rsp+30h],ymm0
000000013F12137D vmovaps ymm0,ymmword ptr [__ymm@404499fbe76c8b44404371eb851eb85240425a9fbe76c8b4404152f1a9fbe76d (01408B7E00h)]
000000013F121385 vmovups ymmword ptr [rsp+50h],ymm0
000000013F12138B vmovaps ymm0,ymmword ptr [__ymm@4049f4dd2f1a9fbe40487fdf3b645a1d40471fdf3b645a1d4045d3b645a1cac1 (01408B7E20h)]
000000013F121393 vmovups ymmword ptr [rsp+70h],ymm0
000000013F121399 vmovaps ymm0,ymmword ptr [__ymm@405059fbe76c8b44404ede147ae147ae404d22b020c49ba6404b800000000000 (01408B7E40h)]
000000013F1213A1 vmovups ymmword ptr [rbp-70h],ymm0
000000013F1213A6 vmovaps ymm0,ymmword ptr [__ymm@40549a0c49ba5e354053720c49ba5e3540525a9fbe76c8b4405152f1a9fbe76d (01408B7E60h)]
000000013F1213AE vmovups ymmword ptr [rbp-50h],ymm0
000000013F1213B3 vmovaps ymm0,ymmword ptr [__ymm@4059f47ae147ae1440587fef9db22d0e40571fef9db22d0e4055d3a5e353f7cf (01408B7E80h)]
000000013F1213BB vmovups ymmword ptr [rbp-30h],ymm0
000000013F1213C0 vmovaps ymm0,ymmword ptr [__ymm@406059eb851eb852405ede147ae147ae405d228f5c28f5c3405b800000000000 (01408B7EA0h)]
000000013F1213C8 vmovups ymmword ptr [rbp-10h],ymm0
...
编辑:正如答案所暗示的,我使用的是 /arch:AVX 编译标志,它不适用于所有机器。