Author: yiran
Date: 2010-09-23 21:34:47 -0400 (Thu, 23 Sep 2010)
New Revision: 3360
Modified:
trunk/osprey/wgen/wgen_stmt.cxx
Log:
Fix of bug 643. For a goto to outer block, the cleanup of local objects are
needed. While, each call of the destructors is nested in a eh-region, as the
destructor itself may throw exceptions. And, for the cleanup of such an
eh-region, destructors should be called for all remaining objects. While,
currently, open64 compiler would call destructors for all local objects,
including the one being destructed. The situation for early exits is similar.
This fix is to temporarily modify the cleanup stack pointer, say, lower it for
each clean-up being issued, and then restore the state. It should be safe as no
new scope or objects would be introduced during this process.\n Reviewed by Lai
Jian-Xin.
Modified: trunk/osprey/wgen/wgen_stmt.cxx
===================================================================
--- trunk/osprey/wgen/wgen_stmt.cxx 2010-09-24 00:57:29 UTC (rev 3359)
+++ trunk/osprey/wgen/wgen_stmt.cxx 2010-09-24 01:34:47 UTC (rev 3360)
@@ -2133,13 +2133,16 @@
if (*li != *ci) break;
if (ci!=Current_scope_nest.rend())
{
+ int scope_cleanup_i_save = scope_cleanup_i;
i = scope_cleanup_i;
Is_True(i != -1, ("WGEN_Expand_Goto: scope_cleanup_stack empty"));
while ((i >= 0) && (scope_cleanup_stack [i].stmt != *ci))
{
+ scope_cleanup_i --;
Maybe_Emit_Cleanup (i, FALSE);
--i;
}
+ scope_cleanup_i = scope_cleanup_i_save;
if (i == -1)
{
#ifdef FE_GNU_4_2_0
@@ -2291,8 +2294,10 @@
#endif
int i = scope_cleanup_i;
+ int scope_cleanup_i_save = scope_cleanup_i;
while (i != -1) {
#ifdef KEY
+ scope_cleanup_i--;
Maybe_Emit_Cleanup (i, FALSE);
#else
if (gs_tree_code(scope_cleanup_stack [i].stmt) == GS_CLEANUP_STMT)
@@ -2301,6 +2306,7 @@
--i;
}
#ifdef KEY
+ scope_cleanup_i = scope_cleanup_i_save;
if (emit_exceptions && processing_handler) {
HANDLER_INFO hi = handler_stack.top();
FmtAssert (hi.scope, ("NULL scope"));
@@ -2398,8 +2404,10 @@
#endif
int i = scope_cleanup_i;
+ int scope_cleanup_i_save = scope_cleanup_i;
while (i != -1) {
#ifdef KEY
+ scope_cleanup_i--;
Maybe_Emit_Cleanup (i, FALSE);
#else
if (gs_tree_code(scope_cleanup_stack [i].stmt) == GS_CLEANUP_STMT)
@@ -2408,6 +2416,7 @@
--i;
}
#ifdef KEY
+ scope_cleanup_i = scope_cleanup_i_save;
if (emit_exceptions && processing_handler) {
HANDLER_INFO hi = handler_stack.top();
FmtAssert (hi.scope, ("NULL scope"));
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel