Author: shihui
Date: 2011-05-04 22:52:50 -0400 (Wed, 04 May 2011)
New Revision: 3585
Modified:
trunk/osprey/be/com/constraint_graph.cxx
Log:
Fix bug766:
In following case, the variable is initialized with a pointer to itself.
static struct tag1 { struct tag1 *next; } s1 = {&s1};
This happens because, when recursively process initialized variables, variable
is marked processed after it is processed.
Fix is mark the variable is processed before call processInitValues, avoid
cyclic initialization dead lock.
Code review by Min Zhao
Modified: trunk/osprey/be/com/constraint_graph.cxx
===================================================================
--- trunk/osprey/be/com/constraint_graph.cxx 2011-05-05 02:45:45 UTC (rev
3584)
+++ trunk/osprey/be/com/constraint_graph.cxx 2011-05-05 02:52:50 UTC (rev
3585)
@@ -1036,8 +1036,8 @@
if (ST_is_initialized(*base_st) &&
(_processedInitVals.find(ST_st_idx(base_st)) ==
_processedInitVals.end())) {
+ _processedInitVals.insert(ST_st_idx(base_st));
processInitValues(ST_st_idx(base_st));
- _processedInitVals.insert(ST_st_idx(base_st));
}
node = getCGNode(CG_ST_st_idx(base_st), base_offset);
}
@@ -1182,8 +1182,8 @@
_processedInitVals.end())) {
if (Get_Trace(TP_ALIAS,NYSTROM_CG_BUILD_FLAG))
fprintf(stderr, "Processing symbol value...\n");
+ _processedInitVals.insert(ST_st_idx(base_st));
processInitValues(ST_st_idx(base_st));
- _processedInitVals.insert(ST_st_idx(base_st));
}
if (Get_Trace(TP_ALIAS,NYSTROM_CG_BUILD_FLAG))
fprintf(stderr, "End processing symbol value...\n");
@@ -2548,8 +2548,8 @@
// If this is the first time we encounter this symbol/node
if (ST_is_initialized(*base_st) &&
_processedInitVals.find(ST_st_idx(base_st)) == _processedInitVals.end())
{
+ _processedInitVals.insert(ST_st_idx(base_st));
processInitValues(ST_st_idx(base_st));
- _processedInitVals.insert(ST_st_idx(base_st));
}
n = getCGNode(CG_ST_st_idx(base_st), base_offset);
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel