Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_GetString(NULL) doesn't crash on HP-UX

Closed / Fixed2073255fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-08-25 09:08:29
When calling Tcl_GetString(NULL) on HP-UX, the effect is:

    UpdateStringProc should not be invoked for type 
    Abort(coredump)

The reason for this is a 'strange' feature of the HP-UX
C compiler:by default NULL-pointer references
are allowed and simply return 0. The problem with this
is that pointer reference mistakes can cause strange
behavior far from the place where the actual error is,
such as the Tcl_GetString(NULL) example.

Proposed solution: Add the "+z" options to CFLAGS
(see patch)
nijtmansplain2008-08-25 16:11:29
Logged In: YES 
user_id=61031
Originator: YES

proposed patch (configure should be re-generated as well):

*** unix/tcl.m4.origMon Aug 25 10:16:51 2008
--- unix/tcl.m4Mon Aug 25 10:24:47 2008
***************
*** 1262,1267 ****
--- 1262,1268 ----
      ])
      AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
      AS_IF([test "$tcl_ok" = yes], [
+ CFLAGS="$CFLAGS -z"
  SHLIB_CFLAGS="+z"
  SHLIB_LD="ld -b"
  SHLIB_LD_LIBS='${LIBS}'
nijtmansplain2008-10-09 04:45:08
Original patch will surely not work with gcc, so restructured a little bit.

Now committed for the Tcl8.6a3/Tk8.6a3 releases. Not worth to backport, therefore can be closed.
nijtmans Closed ticket [2073255fff]. [History diff]2008-10-09 12:38:27
nijtmansplain2008-12-21 16:06:35
Adopted same change in TEA (tclconfig trunk and tea-3-branch)
Log in (anonymous is fine) to add a comment.