RFA: Fix compile time warning in gdb/mips-tdep.c
Andrew Cagney
ac131313@cygnus.com
Fri Aug 11 19:49:00 GMT 2000
Nick Clifton wrote:
>
> Hi Guys,
>
> Whilst working on something else I noticed a warning from gcc about
> a variable in unpack_mips16() which was being used before it was
> initialised. Looking at the code concerned it was obvious that it
> was wrong ('extension' is used without being initialised), but it
> was not obvious what the programmer actually intended. Below is a
> patch that represent my best guess as to what should actually be
> happening.
>
> Is the patch right ? Can I apply it ?
I'm not sure - I don't have the correct manual handy. For the moment,
I'll simply disable this code. As you note it is clearly wrong yet no
one has noticed.
Andrew
> Cheers
> Nick
>
> 2000-08-07 Nick Clifton <nickc@cygnus.com>
>
> * mips-tdep.c (unpack_mips16): Fix the initialisation of
> 'extension' and 'extended'.
>
> Index: gdb/mips-tdep.c
> ===================================================================
> RCS file: /cvs/src//src/gdb/mips-tdep.c,v
> retrieving revision 1.29
> diff -p -r1.29 mips-tdep.c
> *** mips-tdep.c 2000/07/30 01:48:26 1.29
> --- mips-tdep.c 2000/08/07 23:53:03
> *************** unpack_mips16 (CORE_ADDR pc,
> *** 915,928 ****
> CORE_ADDR extpc;
> unsigned long extension;
> int extended;
> ! extpc = (pc - 4) & ~0x01; /* Extensions are 32 bit instructions */
> ! /* Decrement to previous address and loose the 16bit mode flag */
> ! /* return if the instruction was extendable, but not actually extended */
> extended = ((mips32_op (extension) == 30) ? 1 : 0);
> ! if (extended)
> ! {
> ! extension = mips_fetch_instruction (extpc);
> ! }
> switch (upk->fmt)
> {
> case itype:
> --- 915,927 ----
> CORE_ADDR extpc;
> unsigned long extension;
> int extended;
> !
> ! /* Decrement to previous address and loose the 16bit mode flag. */
> ! extpc = (pc - 4) & ~0x01;
> ! /* Extensions are 32 bit instructions. */
> ! extension = mips_fetch_instruction (extpc);
> extended = ((mips32_op (extension) == 30) ? 1 : 0);
> !
> switch (upk->fmt)
> {
> case itype:
More information about the Gdb-patches
mailing list