Browse Source

work around compiler fault

David Rose 24 years ago
parent
commit
06fb9edb9b
1 changed files with 10 additions and 3 deletions
  1. 10 3
      panda/src/sgmanip/nodePath.cxx

+ 10 - 3
panda/src/sgmanip/nodePath.cxx

@@ -3056,11 +3056,12 @@ r_find_matches(NodePathCollection &result,
   num_levels_remaining--;
   num_levels_remaining--;
 
 
   FindApproxLevel next_level;
   FindApproxLevel next_level;
+  bool okflag = true;
 
 
   // For each node in the current level, build up the set of possible
   // For each node in the current level, build up the set of possible
   // matches in the next level.
   // matches in the next level.
   FindApproxLevel::Vec::const_iterator li;
   FindApproxLevel::Vec::const_iterator li;
-  for (li = level._v.begin(); li != level._v.end(); ++li) {
+  for (li = level._v.begin(); li != level._v.end() && okflag; ++li) {
     const FindApproxLevelEntry &entry = (*li);
     const FindApproxLevelEntry &entry = (*li);
 
 
     if (entry.is_solution()) {
     if (entry.is_solution()) {
@@ -3071,12 +3072,18 @@ r_find_matches(NodePathCollection &result,
     }
     }
 
 
     if (max_matches > 0 && result.get_num_paths() >= max_matches) {
     if (max_matches > 0 && result.get_num_paths() >= max_matches) {
-      return;
+      // Really, we just want to return here.  But returning from
+      // within the conditional within the for loop seems to sometimes
+      // cause a compiler fault in GCC.  We'll use a semaphore
+      // variable instead.
+      okflag = false;
     }
     }
   }
   }
 
 
   // Now recurse on the next level.
   // Now recurse on the next level.
-  r_find_matches(result, next_level, max_matches, num_levels_remaining);
+  if (okflag) {
+    r_find_matches(result, next_level, max_matches, num_levels_remaining);
+  }
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////