From mboxrd@z Thu Jan 1 00:00:00 1970 From: Orjan Friberg To: Andrew Cagney Cc: gdb@sources.redhat.com Subject: Re: Uninitialized variable in CRIS port Date: Fri, 21 Sep 2001 11:12:00 -0000 Message-id: <3BAB82FA.A043CDCE@axis.com> References: <3BA9143D.1000502@cygnus.com> X-SW-Source: 2001-09/msg00193.html 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 * 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