This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] rl78: GCC false warning workaround
- From: DJ Delorie <dj at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 10 Apr 2013 15:09:01 -0400
- Subject: Re: [patch] rl78: GCC false warning workaround
- References: <20130410171105 dot GA29559 at host2 dot jankratochvil dot net>
This version is OK. Not the other version. Note: I consider this a
gcc bug, as the switch statement guarantees the array index is in
range.
> opcodes/
> 2013-04-10 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * rl78-dis.c (print_insn_rl78): Use alternative form as a GCC false
> warning workaround.
>
> diff --git a/opcodes/rl78-dis.c b/opcodes/rl78-dis.c
> index 1ceee8d..7d1eab4 100644
> --- a/opcodes/rl78-dis.c
> +++ b/opcodes/rl78-dis.c
> @@ -217,7 +217,7 @@ print_insn_rl78 (bfd_vma addr, disassemble_info * dis)
>
> case '0':
> case '1':
> - oper = opcode.op + *s - '0';
> + oper = *s == '0' ? &opcode.op[0] : &opcode.op[1];
> if (do_es)
> {
> if (oper->use_es && indirect_type (oper->type))
>