Author: shihui
Date: 2011-05-01 03:56:06 -0400 (Sun, 01 May 2011)
New Revision: 3579

Modified:
   trunk/osprey/ipa/main/analyze/ipa_nystrom_alias_analyzer.cxx
Log:
Fix bug768:

Nystrom alias issue: sig fualt in ipa_link when connecting parameters.
Problem is when nystrom ipa connect actual and formal constraint graph nodes,
it assume vararg flag function must have vararg contraint graph node.
This is not correct, because this flag may comes from ipa type merge.

Fix is in ConstraintGraph::connect
1. If last_formal cg node is NULL, don't connect remaining actual nodes with 
last_formal cg node.
2. Another fix is, when callee's last formal constraint graph node is not 
vararg, not connect extra actual with formal.

Code review by Sun Chan


Modified: trunk/osprey/ipa/main/analyze/ipa_nystrom_alias_analyzer.cxx
===================================================================
--- trunk/osprey/ipa/main/analyze/ipa_nystrom_alias_analyzer.cxx        
2011-05-01 01:22:24 UTC (rev 3578)
+++ trunk/osprey/ipa/main/analyze/ipa_nystrom_alias_analyzer.cxx        
2011-05-01 07:56:06 UTC (rev 3579)
@@ -1797,13 +1797,14 @@
   // If we have more actuals than formals either we either have a
   // signature mismatch or varargs.  For now we don't worry about
   // the other mismatch cases.
-  if (actualIter != cs->parms().end() &&
+  // It is possible lastFormal is NULL, and PU is vararg.
+  // When PU is a merged result (merge vararg PU into a non vararg PU).
+  // It's safe to not add any points to to callee, no actual param usage.
+  if (lastFormal != NULL && actualIter != cs->parms().end() &&
       formalIter == callee->parameters().end() &&
-      TY_is_varargs(ST_pu_type(calleeST))) {
+      TY_is_varargs(ST_pu_type(calleeST)) &&
+      lastFormal->stInfo()->checkFlags(CG_ST_FLAGS_VARARGS)) {
     // Hook up remaining actuals to the "varargs" node
-    FmtAssert(callee->stInfo(lastFormal->cg_st_idx())
-                  ->checkFlags(CG_ST_FLAGS_VARARGS),
-                  ("Expect last formal to be varargs!\n"));
     for ( ; actualIter != cs->parms().end(); ++actualIter) {
       ConstraintGraphNode *actual = cgNode(*actualIter);
       if (actual->checkFlags(CG_NODE_FLAGS_NOT_POINTER))


------------------------------------------------------------------------------
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
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to