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. */ /* Must set END_PTR before srandom. */ buf->end_ptr = &state[degree];
@@ -318,7 +318,7 @@ weak_alias (__initstate_r, initstate_r) int __setstate_r (char *arg_state, struct random_data *buf) { - int32_t *new_state = 1 + (int32_t *) arg_state; + int32_t *new_state = 1 + (int32_t *) (unsigned long) arg_state; int type; int old_type; int32_t *old_state; libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wcast-align -Wmissing-prototypes -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -Wno-format -fno-strict-aliasing -Wstrict-aliasing=2 -MT random_r.lo -MD -MP -MF .deps/random_r.Tpo -c random_r.c -fno-common -DPIC -o .libs/random_r.o random_r.c:289:13: warning: cast from 'char *' to 'int32_t *' (aka 'int *') increases required alignment from 1 to 4 [-Wcast-align] state = &((int32_t *) arg_state)[1]; /* First location. */ ^~~~~~~~~~~~~~~~~~~~~ random_r.c:321:28: warning: cast from 'char *' to 'int32_t *' (aka 'int *') increases required alignment from 1 to 4 [-Wcast-align] int32_t *new_state = 1 + (int32_t *) arg_state; ^~~~~~~~~~~~~~~~~~~~~ 2 warnings generated.