This is the mail archive of the gdb-patches@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]

[RFA] Fix uninitialised variable warning error in gdb/stack.c


All,

When compiling GDB with GCC 4.5 and earlier I am getting the following uninitialized variable warning:

/work/sources/gdb/stack.c: In function 'return_command':
/work/sources/gdb/stack.c:2281: error: 'rv_conv' may be used uninitialized in this function
make[1]: *** [stack.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/work/builds/common/gdb'


The attached patch fixes this issue by initializing rv_conv when it is declared. The value used to initialise rv_conv is chosen so that if the code changes in the future and rv_conv really should be uninitialized then the gdb_assert around line 2385 will trigger.

OK for trunk? Tested on x86_64-none-linux-gnu

gdb/ChangeLog:

2013-02-08 Matthew Gretton-Dann <matthew.gretton-dann@linaro.org>

	* stack.c (return_command): Work around uninitialized variable
	warning.

Thanks,

Matt

--
Matthew Gretton-Dann
Toolchain Working Group, Linaro

Attachment: gdb-stack-c-uninit.txt
Description: Text document


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