Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tclUnixPipe.c HP cc pointer truncate warnings

Closed / Wont Fix873897ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 19 years ago
Descriptionplain2004-01-09 17:01:43
The source file unix/tclUnixPipe.c, when compiled with
HP's ANSI C compiler 
with --enable-64bit produces many instances of the error:  
        Cast truncates pointer into 32 bit integer.
These occur on lines 115, 328, 434, 487, 649, 734, 736,
738, 836, 848, 956, 1016, 1064, 1105, 1109, 1115, 1119,
1151, 1155, and 1186.  

(In case the code changes change the line numbers, line
115 is the line:  
       return MakeFile((int)data); 
in proc TclpMakeFile. All the other instances involve
the GetFd macro, and every such instance of GetFd
causes the warning except for 2 that are #ifdef'ed out
of the compilation.)  

The root cause of the warings appears to be that
TclFile is declared (via a typedef) to be a pointer
(specifically of type  (struct TclFile_ *)), but the
code treats it as an int, the macros GetFd and MakeFile
cast it to an int, and eventually the int result is
used as an integer file descriptor to the read and
write UNIX system calls.  

OS:  (uname -a):  HP-UX urkel B.11.00 U 9000/800
1552710528 unlimited-user license

Config flags:  MAKE=gmake CC=/usr/bin/cc ./configure \
  --enable-shared \
  --enable-64bit \
  --prefix=/usr/local/tcl-X/tcl8.5 \
  --exec-prefix=/usr/local/tcl-X/tcl8.5

Compile line:  /usr/bin/cc -c -O -DTCL_DBGX=  +z
-I./../generic -I. +DA2.0W -DPACKAGE_NAME=\"\"
-DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1
-DHAVE_LIMITS_H=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\"
-D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long
-DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1
-DWORDS_BIGENDIAN=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1
-DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1
-DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1
-DHAVE_SYS_MODEM_H=1 -DUSE_TERMIOS=1
-DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1
-DHAVE_TZNAME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1
-DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1
-DHAVE_ST_BLKSIZE=1 -DNO_UNION_WAIT=1 -DNO_GETTOD=1
-DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1
-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1
-DTCL_CFG_DO64BIT=1 -DTCL_CFG_OPTIMIZED=1
-DTCL_CFG_DEBUG=1 -DHAVE_SYS_IOCTL_H=1        
-DTCL_SHLIB_EXT=\".sl\" ./../unix/tclUnixPipe.c
rwurthplain2004-01-10 00:01:43
File Added - 72851: config.log
vincentdarleyplain2004-01-10 01:12:20
Logged In: YES 
user_id=32170

I Know almost nothing about such 64-bit +unix-specific
things...  If you wish to propose a patch which works for
you, I'm happy to review it, else perhaps another maintainer
can look at this.
dkf Ticket [873897ffff]: 2 changes [History diff]2004-01-12 16:57:56
hobbsplain2007-06-13 02:29:03
Logged In: YES 
user_id=72656
Originator: NO

There are several places where pointer truncating occurs with known effect.  Have any of these issues pointed to a bug?
dasplain2007-06-20 12:48:39
Logged In: YES 
user_id=90580
Originator: NO

if intptr_t/uintptr_t are available, all bogus instances of such warnings should have been taken care of by my 2006-11-13 commit adding the PTR2INT(), INT2PTR(), PTR2UINT() and UINT2PTR() macros.
On the 64bit platforms I have access to (darwin, linux, but not HP-UX), I get warning-free builds for the HEAD.
sf-robotplain2007-06-27 09:20:08
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.

Attachments: