Artifacts Associated With Ticket 219196
Ticket change [4d8d0ef312] (rid 127072) by nobody on 2000-10-26 05:03:25:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2715 Bug Version: 8.2 SubmitDate: '1999-09-10' LastModified: '2000-04-03' Severity: SER Status: Assigned Submitter: techsupp ChangedBy: hobbs OS: Digital Unix OSVersion: 4.0f Machine: Other FixedDate: '2000-10-25' ClosedDate: '2000-10-25' Name: Wolfgang S. Kechel ReproducibleScript: Many warnings and inconsistencies when compiling tcl8.2 with gcc-2.95 under Compaq True Unix 4.0f (no threads). The problems are all related to 64/32 bit problems when allocating memory. All allocation problems should use long int for the size parameter. Additionally, stdio.h should be included in some different lines in some headers to make gcc-2.95 happy with varargs. Here is a summary of changes: generic/tclInt.h: move <tt>include <stdio.h></tt> behind the include command for tcl.h (some 5 lines down). generic/tcl.h: move <tt>include <stdio.h></tt> behind the include command for stdarg.h/varargs.h to avoid compilation warnings on some platforms (namely Compaq True Unix 4.0f with gcc-2.95). generic/tclCkalloc.c and generic/tclDecls.h: Change the prototype/signature for Tcl_Alloc and Tcl_Realloc to use <tt>unsigned long</tt> instead of <tt>unsigned int</tt>. generic/tclalloc.c and generic/tclIntDecls.h: Change the prototype/signature for TclpAlloc and TclpRealloc to use <tt>unsigned long</tt> instead of <tt>unsigned int</tt>. generic/tclAlloc.c, generic/tclInt.h: Change the if that checks aginat a returned NULL pointer to check against a malloced size of 0 as well and signal an error only when a NULL pointer is returned for a block of memory that is of non-zero size:<br> <tt>if (result == NULL && size)</tt><br>This is around line 800 in the file. DesiredBehavior: Should compile with gcc-2.95 and -Wall -Wconversion without warnings. Patch: diff tclInt.h /dv10/wke/g40/tcl8.2.0/generic 30,31d29 < #include <stdio.h> < 35a34,35 > #include <stdio.h> > 1697c1697 < EXTERN char * TclpAlloc _ANSI_ARGS_((unsigned int size)); --- > EXTERN char * TclpAlloc _ANSI_ARGS_((unsigned long size)); 1742c1742 < unsigned int size)); --- > unsigned long size)); 118% diff tcl.h /dv10/wke/g40/tcl8.2.0/generic 177,180d176 < #ifndef BUFSIZ < #include <stdio.h> < #endif < 208a205,208 > #endif > > #ifndef BUFSIZ > #include <stdio.h> 119% diff tclCkalloc.c /dv10/wke/g40/tcl8.2.0/generic 566c566,567 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 581c582,583 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 797c799,800 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 802c805 < if (result == NULL) --- > if (result == NULL && size) 839c842,843 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 120% diff tclAlloc.c /dv10/wke/g40/tcl8.2.0/generic 246c246 < unsigned int nbytes; /* Number of bytes to allocate. */ --- > unsigned long nbytes; /* Number of bytes to allocate. */ 492c492 < unsigned int nbytes; /* New size of memory. */ --- > unsigned long nbytes; /* New size of memory. */ 664c664 < unsigned int nbytes; /* Number of bytes to allocate. */ --- > unsigned long nbytes; /* Number of bytes to allocate. */ 712c712 < unsigned int nbytes; /* New size of memory. */ --- > unsigned long nbytes; /* New size of memory. */ 121% PatchFiles: tclInt.h,tcl.h,tclCkalloc.c,tclAlloc.c The problem with alloc'ing 0 bytes was fixed in 8.2.1. The other changes can't be made as provided, as they only apply to a small subset of platforms. We may need to parameterize this. -- 10/19/1999 hobbs This should really be using size_t's. This may be a problem for non-ansi compilers if we change the headers in this way. -- 04/03/2000 hobbs - foundin initialized to: "obsolete: 8.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "75. Tutorial"
- title initialized to:
Compilation problems of tcl8.2 under Compaq True Unix 4.0f w
- type initialized to: "Bug"
Ticket change [9c26ae8d8a] (rid 111235) by dgp on 2001-04-05 06:52:46:
- subsystem changed to: "53. Configuration and Build Tools"
Ticket change [363f0e5a66] (rid 107080) by andreas_kupries on 2001-09-08 06:28:52:
- assignee changed to: "dkf"
Ticket change [ca2ab1a19d] (rid 122418) by dkf on 2001-12-14 18:22:41:
- icomment:
Logged In: YES user_id=79902 Not the time to sort this out properly, but SunOS4.1.4 system headers (*definitely* not ANSI, not with those ioctl definitions!) define both size_t and caddr_t if you include sys/types.h.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [785463f57b] (rid 89943) by dkf on 2001-12-18 22:34:28:
- icomment:
Logged In: YES user_id=79902 Configure includes a helpful macro, AC_TYPE_SIZE_T, that should solve this. Only problem then is to go through all the places that should use it; experience suggests that it is best to limit this to just the primary memory allocation macros to prevent massive cross-contamination trouble...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [18bce3ea2f] (rid 122711) by dkf on 2002-04-25 19:18:06:
- icomment:
Logged In: YES user_id=79902 See also Bug #443938
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [4ceedb1f87] (rid 126978) by dkf on 2002-07-31 17:29:35:
- priority changed to: "7 High"
Ticket change [7cd9208296] (rid 97148) by dkf on 2003-02-10 20:47:49:
- icomment:
Logged In: YES user_id=79902 Some (all?) of these problems should be addressed as part of TIP#115
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Later"
- username: "dkf"
- icomment:
Ticket change [d19cce9984] (rid 113386) by dkf on 2004-06-16 17:49:26:
- title changed to: "size_t != unsigned int"
Ticket change [ce0293b067] (rid 95984) by dgp on 2009-01-09 21:55:48:
- icomment:
Issue is cropping up again in Tcl Bug 2494093. Since we can't fix the API, seems there needs to be an audit of all the memory allocation callers to check whether they permit too large requests to be attempted that get silently overflowed as part of type casting.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [4ed41ebdc6] (rid 125709) by dkf on 2009-03-24 23:21:31:
- icomment:
I won't take any action on this until 9.0 because it is extremely disruptive to both APIs and ABIs on 64-bit platforms.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [f0df76c44b] (rid 109272) by dkf on 2012-11-20 19:18:50:
- icomment:
Fix in progress on novem-64bit-sizes branch; has a *heavy* impact on the C interface. https://core.tcl.tk/tcl/timeline?r=novem-64bit-sizes
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [0f96bfcdaa] (rid 133399) by dkf on 2013-08-21 09:59:49:
- closer changed to: "nobody"
- comment changed to:
OriginalBugID: 2715 Bug Version: 8.2 SubmitDate: '1999-09-10' LastModified: '2000-04-03' Severity: SER Status: Assigned Submitter: techsupp ChangedBy: hobbs OS: Digital Unix OSVersion: 4.0f Machine: Other FixedDate: '2000-10-25' ClosedDate: '2000-10-25' Name: Wolfgang S. Kechel ReproducibleScript: Many warnings and inconsistencies when compiling tcl8.2 with gcc-2.95 under Compaq True Unix 4.0f (no threads). The problems are all related to 64/32 bit problems when allocating memory. All allocation problems should use long int for the size parameter. Additionally, stdio.h should be included in some different lines in some headers to make gcc-2.95 happy with varargs. Here is a summary of changes: generic/tclInt.h: move <tt>include <stdio.h></tt> behind the include command for tcl.h (some 5 lines down). generic/tcl.h: move <tt>include <stdio.h></tt> behind the include command for stdarg.h/varargs.h to avoid compilation warnings on some platforms (namely Compaq True Unix 4.0f with gcc-2.95). generic/tclCkalloc.c and generic/tclDecls.h: Change the prototype/signature for Tcl_Alloc and Tcl_Realloc to use <tt>unsigned long</tt> instead of <tt>unsigned int</tt>. generic/tclalloc.c and generic/tclIntDecls.h: Change the prototype/signature for TclpAlloc and TclpRealloc to use <tt>unsigned long</tt> instead of <tt>unsigned int</tt>. generic/tclAlloc.c, generic/tclInt.h: Change the if that checks aginat a returned NULL pointer to check against a malloced size of 0 as well and signal an error only when a NULL pointer is returned for a block of memory that is of non-zero size:<br> <tt>if (result == NULL && size)</tt><br>This is around line 800 in the file. DesiredBehavior: Should compile with gcc-2.95 and -Wall -Wconversion without warnings. Patch: diff tclInt.h /dv10/wke/g40/tcl8.2.0/generic 30,31d29 < #include <stdio.h> < 35a34,35 > #include <stdio.h> > 1697c1697 < EXTERN char * TclpAlloc _ANSI_ARGS_((unsigned int size)); --- > EXTERN char * TclpAlloc _ANSI_ARGS_((unsigned long size)); 1742c1742 < unsigned int size)); --- > unsigned long size)); 118% diff tcl.h /dv10/wke/g40/tcl8.2.0/generic 177,180d176 < #ifndef BUFSIZ < #include <stdio.h> < #endif < 208a205,208 > #endif > > #ifndef BUFSIZ > #include <stdio.h> 119% diff tclCkalloc.c /dv10/wke/g40/tcl8.2.0/generic 566c566,567 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 581c582,583 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 797c799,800 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 802c805 < if (result == NULL) --- > if (result == NULL && size) 839c842,843 < unsigned int size; --- > /* unsigned int size;*/ > unsigned long size; /* changed by wke */ 120% diff tclAlloc.c /dv10/wke/g40/tcl8.2.0/generic 246c246 < unsigned int nbytes; /* Number of bytes to allocate. */ --- > unsigned long nbytes; /* Number of bytes to allocate. */ 492c492 < unsigned int nbytes; /* New size of memory. */ --- > unsigned long nbytes; /* New size of memory. */ 664c664 < unsigned int nbytes; /* Number of bytes to allocate. */ --- > unsigned long nbytes; /* Number of bytes to allocate. */ 712c712 < unsigned int nbytes; /* New size of memory. */ --- > unsigned long nbytes; /* New size of memory. */ 121% PatchFiles: tclInt.h,tcl.h,tclCkalloc.c,tclAlloc.c The problem with alloc'ing 0 bytes was fixed in 8.2.1. The other changes can't be made as provided, as they only apply to a small subset of platforms. We may need to parameterize this. -- 10/19/1999 hobbs This should really be using size_t's. This may be a problem for non-ansi compilers if we change the headers in this way. -- 04/03/2000 hobbs - icomment:
Formally, this isn't part of any particular subsystem; it's a cross-cutting issue.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- priority changed to: "8"
- severity changed to: "Minor"
- subsystem changed to: "None"
- username: "dkf"
Ticket change [68e527b040] (rid 226672) by dkf on 2024-05-25 12:54:35:
- closedate changed to: "2460456.03791112"
- closer changed to: "dkf"
- icomment:
Fixed in 9.0, at least to the standard required by this issue.
- login: "dkf"
- mimetype: "text/x-markdown"
- resolution changed to: "Fixed"
- status changed to: "Closed"