bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another patch (warning)


From: Bruce Korb
Subject: Re: Another patch (warning)
Date: Thu, 21 Jun 2018 09:22:46 -0700

Hi Eric,
On Thu, Jun 21, 2018 at 5:43 AM Eric Blake <address@hidden> wrote:
>
> On 06/20/2018 02:34 PM, Bruce Korb wrote:
> > diff --git a/lib/random_r.c b/lib/random_r.c
> > index 697ca5f..cd2537a 100644
> > --- a/lib/random_r.c
> > +++ b/lib/random_r.c
> > @@ -286,7 +286,7 @@ __initstate_r (unsigned int seed, char *arg_state,
> > size_t n,
> >    buf->rand_type = type;
> >    buf->rand_sep = separation;
> >    buf->rand_deg = degree;
> > -  state = &((int32_t *) arg_state)[1];  /* First location.  */
> > +  state = &((int32_t *) (unsigned long) arg_state)[1];  /* First location.
>
> Shouldn't that be (uintptr_t) rather than (unsigned long), to be safe on
> machines where long is 32 bits but pointers are 64 (hello Windows)?

I supposed. I hacked it this way because it worked on Linux and OS/X.
I don't do windows. :) Anyway, I think your more careful analysis is correct.
You (gnulib folks) need to use memcpy. Sorry. (Or wrap it with a macro
to accommodate forgiving architectures.)

Cheers - Bruce

reply via email to

[Prev in Thread] Current Thread [Next in Thread]