Subject: Re: CVS commit: src/sys/ufs/ufs
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: source-changes
Date: 02/28/2004 23:57:36
On Sun, Feb 29, 2004 at 02:01:30 +0900, Izumi Tsutsui wrote:

> > Modified Files:
> > 	src/sys/ufs/ufs: ufs_bmap.c
> > 
> > Log Message:
> > Shut up gcc3 warning that `metalbn' might be used uninitialized.
> > XXX: The warning is bogus and only triggered on sh3.
> 
> Isn't it better to use abs()?
> 
> ---
> Index: ufs_bmap.c
> ===================================================================
> RCS file: /cvsroot/src/sys/ufs/ufs/ufs_bmap.c,v
> retrieving revision 1.28
> diff -u -r1.28 ufs_bmap.c
> --- ufs_bmap.c	27 Feb 2004 00:19:36 -0000	1.28
> +++ ufs_bmap.c	28 Feb 2004 16:57:23 -0000
> @@ -341,11 +341,7 @@
>  	}
>  
>  	/* Calculate the address of the first meta-block. */
> -	metalbn = 0;		/* XXX: gcc3 */
> -	if (realbn >= 0)
> -		metalbn = -(realbn - bn + NIADDR - i);
> -	else
> -		metalbn = -(-realbn - bn + NIADDR - i);
> +	metalbn = -(abs(realbn) - bn + NIADDR - i);
>  
>  	/* 
>  	 * At each iteration, off is the offset into the bap array which is

Yes, probably.  I really wanted just a quick kludge to make the full
build pass, so I didn't want to touch the actual code (in my tree with
some additional gcc patches this kludge is not necessary).

Please commit it.

Thanks.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen