On Fri, Oct 21, 2022 at 11:04 AM Klemens Nanni <k...@openbsd.org> wrote:

> --- a/sys/arch/sparc64/sparc64/db_disasm.c
> +++ b/sys/arch/sparc64/sparc64/db_disasm.c
>
...

> @@ -877,7 +877,7 @@ struct sparc_insn sparc_i[] = {
>  vaddr_t
>  db_disasm(vaddr_t loc, int altfmt)
>  {
> -       struct sparc_insn*      i_ptr = (struct sparc_insn *)&sparc_i;
> +       const struct sparc_insn *i_ptr = (const struct sparc_insn
> *)&sparc_i;
>

What's with that cast?  Is it only there because sparc_i is an array and
it's wrong to take its address when we just want a pointer to its first
element?  I mean, shouldn't that line just (with const) be:
        const struct sparc_insn *i_ptr = sparc_i;    /* or &sparc_i[0] */

?

Philip Guenther

Reply via email to