FIX: Unexpected behavior when you run a generated Visual Studio 2008 Service Pack 1 application that calls the setjmp function or the longjmp function in a source file

Article translations Article translations
Article ID: 2498381
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario:
  • You enable the global optimization option (/Og) by enabling one of the following options:
    • /O1 
    • /O2 
    • /Ox 
  • You build a Microsoft Visual C++ source file by using Microsoft Visual Studio 2008 Service Pack 1 (SP1).
  • The source file calls the setjmp function, the longjmp function, or both functions.

In this scenario, the compiler may use the same stack offset to store different local variables. Therefore, unexpected behavior may occur when you run the generated application.

CAUSE

This problem occurs because the optimizer does not account for the setjmp function or the longjmp function. This causes the optimizer to incorrectly calculate the lifetime of the local variables. When one variable is changed, another variable may be changed unexpectedly.

RESOLUTION

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might 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 Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:
http://support.microsoft.com/contactus/?ws=support
Note 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.

To download this hotfix from the Microsoft Developer Network (MSDN) Code Gallery, visit the following Microsoft website:
http://code.msdn.microsoft.com/KB2498381

Note The MSDN Code Gallery displays the languages for which the hotfix is available. If you do not see your language listed, it is because the Code Gallery resource page is not available for that language.

Or, you can download this hotfix from the following Microsoft Connect website:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=34826

Prerequisites

To apply this hotfix, you must have Microsoft Visual Studio 2008 Service Pack 1 installed.

Restart information

You do not have to restart the computer after you install this hotfix if you have stopped all instances of Visual Studio.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The global version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
C2.dll15.0.30729.61472,283,84025-Feb- 201101:25x86
C2.dll15.0.30729.61472,362,68825-Feb- 201101:25x86
C2.dll15.0.30729.61472,493,24825-Feb- 201101:25x86
C2.dll15.0.30729.61473,018,04825-Feb- 201101:25x64
C2.dll15.0.30729.61477,263,04025-Feb-201101:25IA-64
Link.exe9.0.30729.61471,055,56025-Feb- 201101:25x64
Link.exe9.0.30729.61472,135,36825-Feb-201101:25IA-64
Link.exe9.0.30729.6147800,58425-Feb-201101:25x86



WORKAROUND

To work around this problem, initialize the local variables early in the function so that the compiler can be aware of the variables' lifetime. 

STATUS

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

MORE INFORMATION

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates

Properties

Article ID: 2498381 - Last Review: April 21, 2011 - Revision: 2.1
Keywords: 
kbqfe kbhotfixserver kbfix kbexpertiseinter kbsurveynew kbbug KB2498381

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com