This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix latent bug in msp430-tdep.c


*** TEST RESULTS FOR COMMIT ef789dc484a35159ad825c98c4a2502f2097aed7 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: ef789dc484a35159ad825c98c4a2502f2097aed7

Fix latent bug in msp430-tdep.c

-Wshadow=local found this latent bug.  msp430-tdep.c does:

    const gdb_byte *arg_bits;
    {
      /* Aggregates of any size are passed by reference.  */
      gdb_byte struct_addr[4];
[...
      arg_bits = struct_addr;
    }
    ... use arg_bits

Here, arg_bits can point to an object that's gone out of scope.

The fix is to hoist the inner "struct_addr" buffer to an outer scope,
and rename it to avoid shadowing.

gdb/ChangeLog
2018-10-04  Tom Tromey  <tom@tromey.com>

	* msp430-tdep.c (msp430_push_dummy_call): Rename inner
	"structs_addr" and hoist declaration.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]