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]

Re: Re: [PATCH 3/3] Simplify event-loop core, remove two-step event processing


On 03/02/15 22:48, Patrick Palka wrote:
This patch causes a build failure when compiling GDB with GCC 4.9:

/home/patrick/code/binutils-gdb/gdb/event-loop.c: In function
‘gdb_do_one_event’:
/home/patrick/code/binutils-gdb/gdb/event-loop.c:296:10: error: ‘res’
may be used uninitialized in this function
[-Werror=maybe-uninitialized]
        if (res > 0)
           ^


Hi,
Event-loop.c "gdb_do_one_event" function did not initialize variable "res".
This caused gdb_binutils to fail building. This patch fixes it.

Builds with this patch, does not build without it.

Is patch ok? If ok, could you, please, commit (I can't)?

Kind regards,
Alex

gdb/

2015-02-04  Alex Velenko  <Alex.Velenko@arm.com>

  * event-loop.c (gdb_do_one_event): variable "res" initialized.
---
 gdb/event-loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 7425b3a..1e2dc45 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -270,7 +270,7 @@ gdb_do_one_event (void)
      round-robin fashion.  */
   for (current = 0; current < number_of_sources; current++)
     {
-      int res;
+      int res = 0;

       switch (event_source_head)
 	{
--
1.8.1.2



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