A Visual C++ 2010 Win32-based application may crash or other function failures may occur if the project is compiled by using _fastcall and by using an optimization compiler option

Symptoms

Consider the following scenario:

  • You create a Microsoft Visual C++ 2010 Win32-based project.

  • You use the _fastcall keyword in some functions of the project. Or, you set the Calling Convention property for the project to _fastcall.

  • You enable one of the optimization compiler options in Microsoft Visual Studio 2010. For example, you enable the Maximize Speed (/O2) optimization compiler option.

    Note When an optimization compiler option is enabled, the Return Value Optimization (RVO) feature is enabled in Visual Studio 2010.

  • You compile the project, and then you run the application.

In this scenario, the application may crash, or other function failures may occur.

For example, the application crashes because of an access violation exception.

Cause

This issue occurs because incorrect code is generated when the application is compiled by using _fastcall if the RVO feature is enabled. The incorrect code overwrites memory randomly. Therefore, various function failures may occur.  

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=supportNote In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.



Prerequisites

To apply this hotfix, you must have Microsoft Visual Studio 2010 installed. 

Restart requirement



You do not have to restart the computer after you install the hotfix.

Hotfix replacement information


This hotfix does not replace any other hotfix.

File Information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.


For all supported versions of Visual Studio 2010

File name

File version

File size

Date

Time

Platform

C2.dll

16.0.30319.379

2,508,608

25-Oct-2010

08:42

x86

C2.dll

16.0.30319.379

2,588,992

25-Oct-2010

08:42

x86

C2.dll

16.0.30319.379

2,629,440

25-Oct-2010

08:42

x86

C2.dll

16.0.30319.379

2,975,552

25-Oct-2010

08:42

x64

C2.dll

16.0.30319.379

7,351,616

25-Oct-2010

08:42

IA-64


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Kas vajate veel abi?

Täiendage oma oskusi
Tutvuge koolitusmaterjalidega
Kasutage uusi funktsioone enne teisi
Liitu Microsofti Insideri programmis osalejad

Kas sellest teabest oli abi?

Täname tagasiside eest!

Täname tagasiside eest! Tundub, et võiksime teid kokku viia ühega meie Office'i tugiagentidest, kes aitab teil probleemi lahendada.

×