You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Christian Aberger <xm...@Aberger.at> on 2001/04/01 00:21:11 UTC

Re: Possible problem with exception handling on Win32 platform

Thanks for that mail ! Don't know if it has also to do with Xalan, but yes, I
propably I had such a problem. In a project porting an open source C++ SOAP
implemenation that uses Xerces to windoze I experienced crashes that I could
not reproduce in debug builds. The only difference I found by trial and error
was the optimizer settings (in my code). I had no crash after disabling
optimation. I already forwarded this article and your comment below it to this
mailing list also.

Thanks for info.

wfR ChrisA

 > 
> 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
-- 
wfR ChrisA