Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.886
diff -u -r1.886 ChangeLog
--- ChangeLog	28 Feb 2002 05:11:24 -0000	1.886
+++ ChangeLog	28 Feb 2002 12:58:50 -0000
@@ -1,3 +1,8 @@
+2002-02-28  Miguel Sofer  <msofer@users.sourceforge.net>
+
+	* generic/tclExecute.c: Replaced a few direct stack accesses 
+	with the POP_OBJECT() macro [Bug 507181] (Don Porter).
+
 2002-02-27  Don Porter  <dgp@users.sourceforge.net>
 
 	* doc/GetIndex.3:
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.48
diff -u -r1.48 tclExecute.c
--- generic/tclExecute.c	15 Feb 2002 19:58:28 -0000	1.48
+++ generic/tclExecute.c	28 Feb 2002 12:58:53 -0000
@@ -1371,9 +1371,8 @@
 		 */
 
 		for (i = 0;  i < objc;  i++) {
-		    valuePtr = stackPtr[stackTop];
+		    valuePtr = POP_OBJECT();
 		    TclDecrRefCount(valuePtr);
-		    stackTop--;
 		}
 
 		/*
@@ -1886,11 +1885,10 @@
 
 	    opnd = TclGetUInt4AtPtr(pc+1);
 	    valuePtr = Tcl_NewListObj(opnd, &(stackPtr[stackTop - (opnd-1)]));
-
-	    for (i = 0; i < opnd; stackTop--, i++) {
-		TclDecrRefCount(stackPtr[stackTop]);
+	    for (i = 0; i < opnd; i++) {
+		objPtr = POP_OBJECT();
+		TclDecrRefCount(objPtr);
 	    }
-
 	    PUSH_OBJECT(valuePtr);
 	    TRACE_WITH_OBJ(("%u => ", opnd), valuePtr);
 	    ADJUST_PC(5);
@@ -2609,7 +2607,8 @@
 		    /*
 		     * Watch out for multiple references in macros!
 		     */
-		    valuePtr = stackPtr[stackTop--];
+
+		    valuePtr = POP_OBJECT();
 		    TclDecrRefCount(valuePtr);
 		}
 
@@ -2670,7 +2669,8 @@
 		    /*
 		     * Watch out for multiple references in macros!
 		     */
-		    valuePtr = stackPtr[stackTop--];
+
+		    valuePtr = POP_OBJECT();
 		    TclDecrRefCount(valuePtr);
 		}
 
@@ -5822,14 +5822,12 @@
     /*
      * Pop the objc top stack elements and decrement their ref counts.
      */
-		
-    i = (stackTop - (objc-1));
-    while (i <= stackTop) {
-	valuePtr = stackPtr[i];
+
+    k = (stackTop - (objc-1));
+    while (stackTop >= k) {
+	valuePtr = POP_OBJECT();
 	TclDecrRefCount(valuePtr);
-	i++;
     }
-    stackTop -= objc;
     
     /*
      * Push the call's object result.

