Uninitialized variable in CRIS port
Orjan Friberg
orjan.friberg@axis.com
Fri Sep 21 11:12:00 GMT 2001
Andrew Cagney wrote:
>
> /home/scratch/GDB/src/gdb/cris-tdep.c: In function
> `reg_mode_add_sub_cmp_and_or_move_op':
> /home/scratch/GDB/src/gdb/cris-tdep.c:3054: warning: `operand1' might be
> used uninitialized in this function
>
> checking the code, the problem looks real.
Thanks for the reminder. Patch below, confirmed with the weirdest test
case I've ever written. Ok to commit on trunk and branch?
2001-09-21 Orjan Friberg <orjanf@axis.com>
* cris-tdep.c (reg_mode_add_sub_cmp_and_or_move_op): Fetch
operand1
from correct register.
Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 cris-tdep.c
*** cris-tdep.c 2001/09/19 21:59:41 1.3
--- cris-tdep.c 2001/09/21 17:54:03
*************** reg_mode_add_sub_cmp_and_or_move_op (uns
*** 3070,3076 ****
return;
}
/* The instruction has the PC as its target register. */
! operand1 = inst_env->reg[operand1];
operand2 = inst_env->reg[REG_PC];
/* Check if it's a extend, signed or zero instruction. */
--- 3070,3076 ----
return;
}
/* The instruction has the PC as its target register. */
! operand1 = inst_env->reg[cris_get_operand1 (inst)];
operand2 = inst_env->reg[REG_PC];
/* Check if it's a extend, signed or zero instruction. */
--
Orjan Friberg E-mail: orjan.friberg@axis.com
Axis Communications AB Phone: +46 46 272 17 68
More information about the Gdb
mailing list