> > > I suppose there is
> > > 
> > >       *hv = (HOST_WIDE_INT) -(unsigned HOST_WIDE_INT) h1;
> > > 
> > > to make it safe.
> > 
> > Can't that conversion overflow?
> 
> Not on a two's complement machine, 

Then I'm confused about C's arithmetic rules.  Suppose h1 is 1. It's cast
to unsigned, so stays as 1.  Now we do unary minus in unsigned.  That's ~0
because it's done mod 2**32, but interpreted as a POSITIVE number.  Now,
that positive number overflows when converted to signed (the intent is for
that overflow make it negative).  Am I missing something (quite likely!)?

Reply via email to