Subject: Re: mbrlabel bug
To: None <current-users@netbsd.org, adam@pulstar.albedo.com.pl>
From: Wolfgang Solfrank <ws@tools.de>
List: current-users
Date: 11/25/1998 14:59:45
Hi,

> mbrlabel fails while building on MC68xxx machines (at least).
> I've changed 'mbrlabel.c' (line 142) to:
> 
> 	off_t loff = (off_t)(off * DEV_BSIZE);
> 
> and it seems to be okay.  :)

This is obviously a compiler bug.

For the record, the line originally reads:

	off_t loff = (off_t)off * DEV_BSIZE;

and the compiler rejects it with a warning (which is propagated to an error
due to the -Werror) of:

	warning: `loff' might be used uninitialized in this funtion

which is obviously bogus.

There is some subtle difference from your patched version, so your "fix"
isn't even a correct workaround :-(.  The difference shows, when you access
a disk that has an extended partition starting beyond the first 4GB (on
32-bit machines).  With your version, the product is computed with a
precision of 32 bits and then 0-extended to 64 bits.  Thus the offset of
the mbr beyond the 4GB limit is effectively truncated to be below this limit.

What compiler is used on the 68k ports?  Does this show on other ports
using the same compiler?

Ciao,
Wolfgang
-- 
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800