I am writing a script in TCL that is sourced into Cadence's Encounter Digital Implementation Shell. It recursively executes a number of TCL procs and all of a sudden exits the code saying- 'Too many nested evaluations (infinite loop?)'. I located the proc where it errors out and checked the variables being passed as arguments. All values are normal.
I am attaching the part of the proc where it is erroring out. (THe entire script is 1000 lines+ so only mentioning this part).
for {set i 1} {$i<=[llength $xcoord_sinks_for_clone($clone_to_regroup_ref)]} {incr i} {
set abs_dist_list($i) ""
set count 0
foreach clone $new_clone_index_ref2 {
set dist($i) [expr [distance [lindex $xcoord_sinks_for_clone($clone_to_regroup_ref) [expr $i-1]] [lindex $xcoord_clones [expr $clone_to_regroup_ref-1]] [lindex $ycoord_sinks_for_clone($clone_to_regroup_ref) [expr $i-1]] [lindex $ycoord_clones [expr $clone_to_regroup_ref-1]]]-[distance [lindex $xcoord_sinks_for_clone($clone_to_regroup_ref) [expr $i-1]] [lindex $xcoord_clones [expr $clone-1]] [lindex $ycoord_sinks_for_clone($clone_to_regroup_ref) [expr $i-1]] [lindex $ycoord_clones [expr $clone-1]]]]
set dist_abs($i) [expr abs($dist($i))]
lappend abs_dist_list($i) $dist_abs($i)
incr count
}
set sorted_dist_abs($i) [lsort -real $abs_dist_list($i)]
lappend min_dist [lindex $sorted_dist_abs($i) 0]
}
I was able to pin-point the location of the error. Everything happens according to the script till right before the 'set dist($i).....' assignment inside the foreach loop.
Is there some memory-allocation problem? ( The script is running on a Load Sharing Facility)
Please help me out!!
You could try to increase your recursion limit, e.g.: