Subject: pkg/5454: ispell compilation improperly casts between pointer and int on Alpha
To: None <gnats-bugs@gnats.netbsd.org>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: netbsd-bugs
Date: 05/15/1998 04:32:16
>Number:         5454
>Category:       pkg
>Synopsis:       ispell compilation improperly casts between pointer and int on Alpha
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri May 15 01:35:00 1998
>Last-Modified:
>Originator:     Johnny C. Lam
>Organization:
>Release:        1.3E
>Environment:
System: NetBSD kasparov 1.3E NetBSD 1.3E (KASPAROV) #0: Tue May 12 15:39:07 EDT 1998 toor@kasparov:/usr/src/sys/arch/alpha/compile/KASPAROV alpha

>Description:
	ispell sources improperly casts back and forth between
pointers and ints.  This causes warnings on 64bit platforms like
the alpha.

>How-To-Repeat:
N/A

>Fix:

cd /usr/pkgsrc/ispell
patch < the.following.patch

--- ../.dist/Makefile	Tue Apr 21 07:25:18 1998
+++ ./Makefile	Fri May 15 01:05:38 1998
@@ -12,6 +12,10 @@
 MAKE_FLAGS=	TMPDIR=${.CURDIR} -f
 SCRIPTS_ENV=	"LANG=${LANG}"
 
+.if (${MACHINE_ARCH} == "alpha")
+SCRIPTS_ENV+=	"BIT64=YES"
+.endif
+
 MAN1=		buildhash.1 findaffix.1 ispell.1 munchlist.1 \
 		sq.1 tryaffix.1 unsq.1
 MAN4=		ispell.4 english.4
--- ../.dist/patches/patch-ac	Fri May 15 02:00:48 1998
+++ ./patches/patch-ac	Fri May 15 00:51:08 1998
@@ -0,0 +1,17 @@
+--- config.X.orig	Mon Jan 23 13:28:24 1995
++++ config.X	Fri May 15 00:46:21 1998
+@@ -537,6 +537,14 @@
+ #define MASKBITS	MASKTYPE_WIDTH
+ #endif /* MASKBITS < MASKTYPE_WIDTH */
+ 
++/*
++** C int type that is the same size as (void *).
++**
++** PTR_INT is used to convert back-and-forth between pointers and ints.
++*/
++#ifndef PTR_INT
++#define PTR_INT		int
++#endif
+ 
+ /* maximum number of include files supported by xgets;  set to 0 to disable */
+ #ifndef MAXINCLUDEFILES
--- ../.dist/patches/patch-ad	Fri May 15 02:00:48 1998
+++ ./patches/patch-ad	Fri May 15 00:51:23 1998
@@ -0,0 +1,13 @@
+--- ispell.h.orig	Thu Oct 12 15:04:08 1995
++++ ispell.h	Fri May 15 00:48:13 1998
+@@ -336,8 +336,8 @@
+     short maxstringcharlen;			/* Max strchr len supported */
+     short compoundmin;				/* Min lth of compound parts */
+     short compoundbit;				/* Flag 4 compounding roots */
+-    int stringsize;				/* Size of string table */
+-    int lstringsize;				/* Size of lang. str tbl */
++    PTR_INT stringsize;				/* Size of string table */
++    PTR_INT lstringsize;			/* Size of lang. str tbl */
+     int tblsize;				/* No. entries in hash tbl */
+     int stblsize;				/* No. entries in sfx tbl */
+     int ptblsize;				/* No. entries in pfx tbl */
--- ../.dist/patches/patch-ae	Fri May 15 02:00:48 1998
+++ ./patches/patch-ae	Fri May 15 00:53:09 1998
@@ -0,0 +1,20 @@
+--- buildhash.c.orig	Mon Jan 23 13:28:24 1995
++++ buildhash.c	Fri May 15 00:41:13 1998
+@@ -211,7 +211,7 @@
+     {
+     register FILE *		houtfile;
+     register struct dent *	dp;
+-    int				strptr;
++    PTR_INT			strptr;
+     int				n;
+     int				i;
+     int				maxplen;
+@@ -336,7 +336,7 @@
+ 	{
+ 	if (dp->next != 0)
+ 	    {
+-	    int		x;
++	    PTR_INT	x;
+ 	    x = dp->next - hashtbl;
+ 	    dp->next = (struct dent *)x;
+ 	    }
--- ../.dist/patches/patch-af	Fri May 15 02:00:48 1998
+++ ./patches/patch-af	Fri May 15 00:53:23 1998
@@ -0,0 +1,29 @@
+--- lookup.c.orig	Mon Jan 23 13:28:27 1995
++++ lookup.c	Fri May 15 00:41:48 1998
+@@ -212,22 +212,22 @@
+ 	    if (dp->word == (char *) -1)
+ 		dp->word = NULL;
+ 	    else
+-		dp->word = &hashstrings [ (int)(dp->word) ];
++		dp->word = &hashstrings [ (PTR_INT)(dp->word) ];
+ 	    if (dp->next == (struct dent *) -1)
+ 		dp->next = NULL;
+ 	    else
+-		dp->next = &hashtbl [ (int)(dp->next) ];
++		dp->next = &hashtbl [ (PTR_INT)(dp->next) ];
+ 	    }
+ 	}
+ 
+     for (i = numsflags + numpflags, entry = sflaglist; --i >= 0; entry++)
+ 	{
+ 	if (entry->stripl)
+-	    entry->strip = (ichar_t *) &hashstrings[(int) entry->strip];
++	    entry->strip = (ichar_t *) &hashstrings[(PTR_INT) entry->strip];
+ 	else
+ 	    entry->strip = NULL;
+ 	if (entry->affl)
+-	    entry->affix = (ichar_t *) &hashstrings[(int) entry->affix];
++	    entry->affix = (ichar_t *) &hashstrings[(PTR_INT) entry->affix];
+ 	else
+ 	    entry->affix = NULL;
+ 	}
--- ../.dist/scripts/configure	Mon Jan 12 07:55:47 1998
+++ ./scripts/configure	Fri May 15 01:06:00 1998
@@ -46,6 +46,13 @@
 echo '#undef ELISPDIR'  >> local.h
 echo "#define ELISPDIR \"$PREFIX/share/emacs/site-lisp\"" >> local.h
 
+if [ x${BIT64} = xYES ]; then
+  echo "#define MASKTYPE_WIDTH	64" >> local.h
+  echo "#define PTR_INT		int64_t" >> local.h
+else
+  echo "#define PTR_INT		int32_t" >> local.h
+fi
+
 mv Makefile Makefile.orig
 sed -e 's/^[ 	]*$/\
 /' <Makefile.orig >Makefile
>Audit-Trail:
>Unformatted: