Hi Eric, On Thu, Jun 21, 2018 at 5:43 AM Eric Blake <ebl...@redhat.com> 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