Subject: bin/29953: today's change to /usr/src/sbin/fsck_lfs/lfs.c breaks 64bit machines
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <paul@Plectere.com>
List: netbsd-bugs
Date: 04/12/2005 05:30:01
>Number: 29953
>Category: bin
>Synopsis: assumes pointer is 32 bits
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 12 05:30:00 +0000 2005
>Originator: Paul Shupak
>Release: NetBSD 3.99.2
>Organization:
>Environment:
NetBSD athalon64-2800 3.99.2 NetBSD 3.99.2 (ATHALON64-2800) #3: Mon Apr 7 11:41:52 PST 2005 root@athalon64-2800:/sys/arch/amd64/compile/ATHALON64-2800 amd64
Machine: amd64
>Description:
Build breaks due to fatal compiler warning about cast of pointer
to an int of a different size. Since the value is only used as
a "hash", there is no real problem, and a trivial cast can/will
fix it.
>How-To-Repeat:
try to build fsck_lfs or newfs_lfs on a 64 bit machine
>Fix:
cvs diff -c lfs.c
Index: lfs.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_lfs/lfs.c,v
retrieving revision 1.10
diff -c -r1.10 lfs.c
*** lfs.c 11 Apr 2005 23:19:24 -0000 1.10
--- lfs.c 12 Apr 2005 05:24:15 -0000
***************
*** 406,412 ****
ip->i_lfs_fragsize[i] = blksize(fs, ip, i);
++nvnodes;
! hash = ((int)fs + ino) & (VNODE_HASH_MAX - 1);
LIST_INSERT_HEAD(&getvnodelist[hash], vp, v_getvnodes);
LIST_INSERT_HEAD(&vnodelist, vp, v_mntvnodes);
--- 406,412 ----
ip->i_lfs_fragsize[i] = blksize(fs, ip, i);
++nvnodes;
! hash = ((int)(long int)fs + ino) & (VNODE_HASH_MAX - 1);
LIST_INSERT_HEAD(&getvnodelist[hash], vp, v_getvnodes);
LIST_INSERT_HEAD(&vnodelist, vp, v_mntvnodes);
>Unformatted: