Hi,

We had a problem in part of our code with Microsoft's global optimisation in
Visual C++ v6.0. Through a review of the modules that we use in our product
it became apparent that Xerces and Xalan may also suffer from this problem.
There's a knowledge base article about the problem as it relates to
exception handling (Knowledge base ID: Q247203):

BUG: Try/Catch Block May Fail when Global Optimizations (/Og) Are Enabled 

----------------------------------------------------------------------------
----
The information in this article applies to:

Microsoft Visual C++, 32-bit Editions, version 6.0

----------------------------------------------------------------------------
----

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
Microsoft has confirmed this to be a bug in the Microsoft products listed at
the beginning of this article.

As the article says, the bug may occur when 'global optimisations' are
selected and can result in mis-application of catch blocks.  All Xerxes and
Xalan projects appear to use /O2 which includes global optimisations as part
of a composite switch. Workaround is to et /EHa (async exception handling).
I suggest adding this flag to all Xerces and Xalan projects.

Best Regards
John Roper
iOra Ltd.

www.iOra.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to