NetBSD Problem Report #5454

Received: (qmail 19192 invoked from network); 15 May 1998 08:32:19 -0000
Message-Id: <199805150832.EAA04957@insane.stat.cmu.edu>
Date: Fri, 15 May 1998 04:32:16 -0400
From: "Johnny C. Lam" <lamj@stat.cmu.edu>
Reply-To: lamj@stat.cmu.edu
To: gnats-bugs@gnats.netbsd.org
Cc: lamj@stat.cmu.edu
Subject: ispell compilation improperly casts between pointer and int on Alpha
X-Send-Pr-Version: 3.95

>Number:         5454
>Category:       pkg
>Synopsis:       ispell compilation improperly casts between pointer and int on Alpha
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    garbled
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri May 15 01:35:00 +0000 1998
>Closed-Date:    Thu Nov 05 19:47:50 +0000 1998
>Last-Modified:  Thu Nov 05 19:48:37 +0000 1998
>Originator:     Johnny C. Lam
>Release:        1.3E
>Organization:
>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
>Release-Note:
>Audit-Trail:

From: David Brownlee <abs@anim.dreamworks.com>
To: "Johnny C. Lam" <lamj@stat.cmu.edu>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/5454: ispell compilation improperly casts between pointer and int on Alpha
Date: Fri, 15 May 1998 10:04:02 -0700 (PDT)

 	Rather than use ${MACHINE_ARCH} to key off on this should the
 	system Makefiles or cpp define the type of ILP model used by the
 	current system?, otherwise all the files need to be modified again
 	when we get another port with 64bit longs/pointers...

 		David/absolute

            -=-  "If there is a hell... I'll see you there"  -=-

 On Fri, 15 May 1998, Johnny C. Lam wrote:

 > 
 > >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:
 > 


From: "Johnny C. Lam" <lamj@stat.cmu.edu>
To: David Brownlee <abs@anim.dreamworks.com>
Cc: "Johnny C. Lam" <lamj@stat.cmu.edu>, gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/5454: ispell compilation improperly casts between pointer and int on Alpha 
Date: Fri, 15 May 1998 14:52:25 -0400

 > 	Rather than use ${MACHINE_ARCH} to key off on this should the
 > 	system Makefiles or cpp define the type of ILP model used by the
 > 	current system?, otherwise all the files need to be modified again
 > 	when we get another port with 64bit longs/pointers...
 > 
 > 		David/absolute

 Yeah, that would be better, but I didn't find any good system Makefile
 variables or CPP defines that gave the size of the ptrs and longs.
 How about a GNU-configure-like addition to ispell/scripts/configure
 that compiles test programs to find the sizes of types?  This is
 implemented in the patch below.  Then the changes to ispell/Makefile
 that keyed off of ${MACHINE_ARCH} could go away.

 --
    Johnny C. Lam
    Department of Statistics             lamj@stat.cmu.edu
    Carnegie Mellon University           http://www.stat.cmu.edu/~lamj/

                             @>---`---,----

 --- .dist/scripts/configure     Mon Jan 12 07:55:47 1998
 +++ scripts/configure   Fri May 15 14:44:52 1998
 @@ -46,6 +46,30 @@
  echo '#undef ELISPDIR'  >> local.h
  echo "#define ELISPDIR \"$PREFIX/share/emacs/site-lisp\"" >> local.h

 +cat <<EOF > ${WRKDIR}/ptrsize.c
 +#include <stdio.h>
 +int main() { printf("%d\n", 8*sizeof(void *)); return 0; }
 +EOF
 +
 +cat <<EOF > ${WRKDIR}/ptrsize.c
 +#include <stdio.h>
 +int main() { printf("%d\n", 8*sizeof(long)); return 0; }
 +EOF
 +
 +cc -o ${WRKDIR}/ptrsize ${WRKDIR}/ptrsize.c
 +cc -o ${WRKDIR}/longsize ${WRKDIR}/longsize.c
 +
 +PTRSIZE=`${WRKDIR}/ptrsize`
 +LONGSIZE=`${WRKDIR}/longsize`
 +
 +echo "#define MASKTYPE_WIDTH	${LONGSIZE}" >> local.h
 +echo "#define PTR_INT		int${PTRSIZE}_t" >> local.h
 +
 +rm -f ${WRKDIR}/ptrsize
 +rm -f ${WRKDIR}/ptrsize.c
 +rm -f ${WRKDIR}/longsize
 +rm -f ${WRKDIR}/longsize.c
 +
  mv Makefile Makefile.orig
  sed -e 's/^[   ]*$/\
  /' <Makefile.orig >Makefile


From: "Johnny C. Lam" <lamj@stat.cmu.edu>
To: "Johnny C. Lam" <lamj@stat.cmu.edu>
Cc: David Brownlee <abs@anim.dreamworks.com>, gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/5454: ispell compilation improperly casts between pointer and int on Alpha 
Date: Sat, 16 May 1998 14:14:07 -0400

 Okay, forget all of the other "fixes" I've sent thus far.  After
 asking on port-alpha about how to fix this type of thing "portably"
 and cleanly, I think the following does it the right way -- no
 #ifdef's and no dependencies on platform architectures.  It's a single
 patch to be applied with:

 	cd /usr/pkgsrc/textproc
 	patch < ispell.patch

 --- ispell/.dist/scripts/configure	Mon Jan 12 07:55:47 1998
 +++ ispell/scripts/configure	Sat May 16 13:28:48 1998
 @@ -46,6 +46,8 @@
  echo '#undef ELISPDIR'  >> local.h
  echo "#define ELISPDIR \"$PREFIX/share/emacs/site-lisp\"" >> local.h

 +echo "#define MASKTYPE	int32_t" >> local.h
 +
  mv Makefile Makefile.orig
  sed -e 's/^[ 	]*$/\
  /' <Makefile.orig >Makefile
 --- /dev/null	Sat May 16 13:40:25 1998
 +++ ispell/patches/patch-ac	Sat May 16 13:16:53 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 */
 ++    long stringsize;				/* Size of string table */
 ++    long 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 */
 --- /dev/null	Sat May 16 13:40:25 1998
 +++ ispell/patches/patch-ad	Sat May 16 13:37:20 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;
 ++    long				strptr;
 +     int				n;
 +     int				i;
 +     int				maxplen;
 +@@ -336,7 +336,7 @@
 + 	{
 + 	if (dp->next != 0)
 + 	    {
 +-	    int		x;
 ++	    long	x;
 + 	    x = dp->next - hashtbl;
 + 	    dp->next = (struct dent *)x;
 + 	    }
 --- /dev/null	Sat May 16 13:40:25 1998
 +++ ispell/patches/patch-ae	Sat May 16 13:17:36 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 [ (long)(dp->word) ];
 + 	    if (dp->next == (struct dent *) -1)
 + 		dp->next = NULL;
 + 	    else
 +-		dp->next = &hashtbl [ (int)(dp->next) ];
 ++		dp->next = &hashtbl [ (long)(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[(long) entry->strip];
 + 	else
 + 	    entry->strip = NULL;
 + 	if (entry->affl)
 +-	    entry->affix = (ichar_t *) &hashstrings[(int) entry->affix];
 ++	    entry->affix = (ichar_t *) &hashstrings[(long) entry->affix];
 + 	else
 + 	    entry->affix = NULL;
 + 	}

State-Changed-From-To: open->feedback 
State-Changed-By: garbled 
State-Changed-When: Mon Oct 26 23:21:21 PST 1998 
State-Changed-Why:  
I have comitted a fix for this, Please sup the latest pkgsrc and try 
your build again.  If it works/doesn't work, please respond so I can 
close this PR out finally..  Thanks.. ;) 
Tim 
. 


Responsible-Changed-From-To: gnats-admin->garbled 
Responsible-Changed-By: garbled 
Responsible-Changed-When: Mon Oct 26 23:21:21 PST 1998 
Responsible-Changed-Why:  
I seem to be the alpha-pkg guy these days.. might as well. 
State-Changed-From-To: feedback->closed 
State-Changed-By: garbled 
State-Changed-When: Thu Nov 5 11:47:50 PST 1998 
State-Changed-Why:  
Thanks for the feedback.. sorry to hear about your multia. ;( 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.