Subject: Re: gcc-current and warnings in bin/sh
To: David Laight <firstname.lastname@example.org>
From: Ben Harris <email@example.com>
Date: 06/05/2002 22:52:40
On Wed, 5 Jun 2002, David Laight wrote:
> On Fri, May 31, 2002 at 07:16:01PM +0100, Ben Harris wrote:
> > In article <GwzK2v.H4E@tac.nyc.ny.us> you write:
> > >for systems with signed chars this ended up being
> > >
> > >#define UPEOF -129
> > >
> > >which is out of range for char. (it has been fixed)
> > Ah. I hadn't noticed the strange dance being done with "base" in the signed
> > case.
> Because it isn't! dunno where -129 might come from!
The "strange dance" I meant was:
base = 1;
base += 1 << (nbits - 1);
If nbits == 8 and sign == 1, you get base == 129, so this:
fprintf(hfile, "#define UPEOF %d\n\n", -base);
fprintf(hfile, "#define UPEOF ((unsigned char) %d)\n\n", -base);
... will define UPEOF to -129, which is what was causing the problem.
Ben Harris <firstname.lastname@example.org>
Portmaster, NetBSD/acorn26 <URL:http://www.netbsd.org/Ports/acorn26/>