Re: [PATCH] sim: mn10300: clean up pointer casts

Christian Biesinger via Gdb-patches
2021-11-01T16:08:46Z

On Sun, Oct 31, 2021 at 11:45 PM Mike Frysinger via Gdb-patches
<gdb-patches@sourceware.org> wrote:
> --- a/sim/mn10300/dv-mn103ser.c
> +++ b/sim/mn10300/dv-mn103ser.c
> @@ -238,7 +238,7 @@ do_polling_event (struct hw *me,
> {
> SIM_DESC sd = hw_system (me);
> struct mn103ser *serial = hw_data(me);
> - long serial_reg = (long) data;
> + long serial_reg = (uintptr_t) data;

Shouldn't you change the variable type too? Otherwise this patch seems
to be somewhat pointless?
if ( nr_bytes == 1 )

> diff --git a/sim/mn10300/dv-mn103tim.c b/sim/mn10300/dv-mn103tim.c
> index ad9c24bbc6e8..76f87380d1d8 100644
> --- a/sim/mn10300/dv-mn103tim.c
> +++ b/sim/mn10300/dv-mn103tim.c
> @@ -570,7 +570,7 @@ do_counter_event (struct hw *me,
> void *data)
> {
> struct mn103tim *timers = hw_data(me);
> - long timer_nr = (long) data;
> + long timer_nr = (uintptr_t) data;

Here too.

> @@ -611,7 +611,7 @@ do_counter6_event (struct hw *me,
> void *data)
> {
> struct mn103tim *timers = hw_data(me);
> - long timer_nr = (long) data;
> + long timer_nr = (uintptr_t) data;

And here.

Christian