From af320fb41e62980c0c988a377c138ac14757ad81 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 May 2023 12:53:45 +0000 Subject: Fix [9c397da4a9]: AppendPrintfToObjVA(): support 64-bit pointers --- generic/tcl.h | 2 +- generic/tclStringObj.c | 8 ++++++-- generic/tclStringRep.h | 2 +- tests/tailcall.test | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 318c7a1..2b6c947 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2176,7 +2176,7 @@ typedef struct Tcl_EncodingType { #define TCL_ENCODING_CHAR_LIMIT 0x10 /* Internal use bits, do not define bits in this space. See above comment */ #define TCL_ENCODING_INTERNAL_USE_MASK 0xFF00 -/* +/* * Reserve top byte for profile values (disjoint, not a mask). In case of * changes, ensure ENCODING_PROFILE_* macros in tclInt.h are modified if * necessary. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7fbf77a..0e47487 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -249,7 +249,7 @@ UpdateStringOfUTF16String( #endif #endif - + /* * TCL STRING GROWTH ALGORITHM * @@ -3130,12 +3130,16 @@ AppendPrintfToObjVA( break; } + case 'p': + if (sizeof(size_t) == sizeof(Tcl_WideInt)) { + size = 2; + } + /* FALLTHRU */ case 'c': case 'i': case 'u': case 'd': case 'o': - case 'p': case 'x': case 'X': seekingConversion = 0; diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index ef64d6c..d1863fb 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -22,7 +22,7 @@ /* * The following structure is the internal rep for a String object. It keeps * track of how much memory has been used and how much has been allocated for - * the various representations to enable growing and shrinking of + * the various representations to enable growing and shrinking of * the String object with fewer mallocs. To optimize string * length and indexing operations, this structure also stores the number of * code points (independent of encoding form) once that value has been computed. diff --git a/tests/tailcall.test b/tests/tailcall.test index c9ec674..0016845 100644 --- a/tests/tailcall.test +++ b/tests/tailcall.test @@ -709,7 +709,7 @@ test tailcall-14.1-bc {{in a deleted namespace} {byte compiled}} -body { } -returnCodes 1 -result {namespace "::ns" not found} test tailcall-bug-784befb0ba {tailcall crash with 254 args} -body { - proc tccrash args {llength $args} + proc tccrash args {llength $args} # Must be EXACTLY 254 for crash proc p {} [list tailcall tccrash {*}[lrepeat 254 x]] p -- cgit v0.12