FIX: Try/Catch Block May Fail when Global Optimizations (/Og) Are Enabled (247203)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q247203 SYMPTOMS
When trying to build an application that uses C++ exception handling, with global optimizations enabled, the catch handler within the try/catch block may not catch any of the exceptions that are thrown by the instructions in the try block. See the "More Information" section below for details.
CAUSE
The optimizer optimizes the try/catch block incorrectly.
RESOLUTION
Here are the two ways to work around this problem: - Disable global optimizations on a function-by-function basis using the optimize pragma with the "g" option. /Og- disables global optimization on a file-by-file basis.
- Use the asynchronous exception handling model by specifying the /EHa compiler option.
STATUS
This bug was corrected in Microsoft Visual C++ .NET 2002.
Modification Type: | Major | Last Reviewed: | 1/22/2004 |
---|
Keywords: | kbbug kbpending KB247203 |
---|
|