Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Symptoms

When you build a program by using Microsoft Visual C++ 2013, the program crashes and you receive an "Illegal Instruction" exception. This occurs because some floating-point math library functions in the Visual C++ 2013 x64 C Runtime (CRT) do not correctly check whether certain AVX and FMA3 instructions are available before the functions try to use them. If the instructions are not available for use, calls to these functions cause an illegal instruction exception (0xc000001d). Affected functions include log, log10, and pow, and others. 

This problem is most likely to occur in the following scenarios:

  • On an old version of the Windows operating system that does not support AVX state saving (for example, Windows Vista) if it's used on a computer that supports the AVX instruction set

  • If AVX state saving is explicitly disabled in the operating system boot configuration

  • In the Windows Preinstall Environment (Windows PE)

    Note Windows PE does not support AVX state saving.


This problem has been reported on Microsoft Connect:

x64 log() function uses vpsrlq AVX instruction without regard to operating system (so it crashes on Vista x64)

Visual Studio 2013 RTM: C++ x64 code generation bug for AVX2 instructions

Cause

This issue occurs because the Visual C++ 2013 x64 C Runtime does not check whether the operating system supports AVX state saving before it tries to run AVX or FMA3 instructions.

Resolution

If all affected C++ binaries that are built by using Visual C++ 2013 use the C Runtime DLL (msvcr120.dll), install the updated Microsoft Visual C++ 2013 Redistributable – 12.0.40660.0 or a later version.

If your affected C++ binaries statically link the Visual C++ 2013 C Runtime, you must update your installation of Visual Studio 2013 by installing the 3174417 hotfix and rebuilding and redeploying the affected binaries.









Note This problem does not affect older versions of the Visual C++ C Runtime (Visual C++ 2012 and earlier versions). The problem was fixed before the initial release of the Universal CRT that is used by Visual C++ 2015.

Microsoft Download Center

To update the statically linked Visual C++ 2013 C Runtime, the 3174417 hotfix is released as a download-only update and isn't distributed through Windows Update. It is available at the Microsoft Download Center website:

DownloadDownload the package now.

To update the dynamically linked Visual C++ 2013 C Runtime DLLs, an updated redistributable is available. For more information, see the following Microsoft Knowledge Base article:

3179560 Update for Visual C++ 2013 and Visual C++ Redistributable Package

Workaround

To work around this problem, disable FMA3 in the math library if you are affected by this problem. You can query whether the system supports AVX instructions by calling GetEnabledXStateFeatures and disabling AVX in the CRT explicitly by calling _set_FMA3_enable(0).

For more information, see Working with XState Contexton the MSDN website.

The function _set_FMA3_enable(0) is declared in <math.h>, and it's available only when you build for x64. (This problem affects only the x64 libraries.) This causes the math library to revert to using the non-FMA3 implementations.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×