summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--generic/tclCkalloc.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f2859bc..c6554dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
Add /usr/lib64 to set of auto-search dirs. [Bug 1230554]
(SC_PATH_X): Correct syntax error when xincludes not found.
Backported from Tcl 8.5
+ * generic/tclCkalloc.c: [Bug #3197864] pointer truncation on Win64
+ TCL_MEM_DEBUG builds
2010-03-11 Jan Nijtmans <nijtmans@users.sf.net>
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index 07fdf4c..e81eaea 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -82,7 +82,7 @@ static struct mem_header *allocHead = NULL; /* List of allocated structures */
*/
#define BODY_OFFSET \
- ((unsigned long) (&((struct mem_header *) 0)->body))
+ ((size_t) (&((struct mem_header *) 0)->body))
static int total_mallocs = 0;
static int total_frees = 0;
@@ -577,7 +577,7 @@ Tcl_DbCkfree(ptr, file, line)
* even though BODY_OFFSET is in words on these machines).
*/
- memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET);
+ memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
if (alloc_tracing) {
fprintf(stderr, "ckfree %lx %ld %s %d\n",
@@ -652,7 +652,7 @@ Tcl_DbCkrealloc(ptr, size, file, line)
* line.
*/
- memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET);
+ memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
copySize = size;
if (copySize > (unsigned int) memp->length) {
@@ -684,7 +684,7 @@ Tcl_AttemptDbCkrealloc(ptr, size, file, line)
* line.
*/
- memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET);
+ memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
copySize = size;
if (copySize > (unsigned int) memp->length) {