Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2000-10-26
08:23 • Closed ticket [218520ffff]: pointers are not integers (Tcl code is non standard)... artifact: a8393bb728 user: welch
01:01 • New ticket [218520ffff]. artifact: 3ed68ef5be user: nobody

pointers are not integers (Tcl code is non standard) - 64 bi

Closed / Fixed218520ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:37
OriginalBugID: 863 Bug
Version: 8.0.3
SubmitDate: '1998-11-25'
LastModified: '1999-10-21'
Severity: MED
Status: Released
Submitter: pat
ChangedBy: hobbs
OS: All
OSVersion: NA
Machine: NA
FixedDate: '1999-10-21'
FixedInVersion: 8.2
ClosedDate: '2000-10-25'


Date: Sun, 8 Nov 1998 21:35:49 -0800 (PST)
To: [email protected]
Cc: [email protected]
Subject: pointers are not integers (Tcl code is non standard)
From: [email protected]
Status: O

Tcl 8.0.3 Bug

email:  [email protected]
Support:  None
Severity:  1
OperatingSystem:  Other
OperatingSystemVersion:  NEC Super-UX R8.2, Cray Unicos 9.2
Synopsis:  pointers are not integers (Tcl code is non standard)

Comments:
Can't compile and execute successfully on 64 bit systems. Many bugs can be cured by using
#include <stddef.h> /* ANSI standard */
and casting to type ptrdiff_t
I changed unix/configure.in to include:
AC_CHECK_HEADER(stddef.h, tcl_ok=1, tcl_ok=0)
if test $tcl_ok = 1; then
AC_CHECK_TYPE(ptrdiff_t, int)
else
    AC_DEFINE(NO_STDDEF_H)
fi
Changed many occurrences of pointer differences being treated as integer. e.g
generic/regexp.c has in function regtail()
        if (OP(scan) == BACK)
                offset = scan - val;
        else
                offset = val - scan;
which should be
        if (OP(scan) == BACK)
                offset = (ptr_diff_t)(scan - val);
        else
                offset = (ptrdiff_t)(val - scan);
When an integer is 32 bits and an address is 40 bits, the original doesn't work. When a char *
comprises a character offset followed by a word address, the subtraction is nonsense. Unresolved
problems: What did the author(s) really mean in
generic/tclCompile.c in the function  int TclObjIndexForString() which attempts
[ line 7032 ]  to create an integer by 
objIndex = (int) Tcl_GetHashValue(hPtr);
?? How can this work if the ponter is 64 bits.
Truncate and guess a value? :-(
Cheers,
     Len Makin



4/16/99 - redman - the code described no longer exists (regexp.c) in 8.1.  8.1 tested on 64bit Solaris works fine.  Whether or not to fix in 8.0.x is another question.
--
This has been fixed for 8.1+, which is the current stable release. 
-- 10/21/1999 hobbs
welch Closed ticket [218520ffff]. [History diff]2000-10-26 08:23:19
Log in (anonymous is fine) to add a comment.