Fix GDB build when using GCC 4.1.2

Message ID 0adf15e3-d761-4de7-9ac7-ba3e3f283942@BAMAIL02.ba.imgtec.org
State New, archived
Headers

Commit Message

Steve Ellcey Dec. 1, 2015, 5:38 p.m. UTC
  A recent gdb change has broken my ability to build gdb with GCC 4.1.2. It
dies with:

/scratch/sellcey/repos/gdb/src/gdb/gdb/remote.c: In function 'remote_newthread_step':
/scratch/sellcey/repos/gdb/src/gdb/gdb/remote.c:2844: warning: 'item.name' is used uninitialized in this function
make[1]: *** [remote.o] Error 1


I am not seeing this error with newer GCC versions that I build with so it
may be a GCC bug but I would like to change gdb so I can still build with
GCC 4.1.2.  The fix is to simply initialize item.name in the locations where
item.extra is already being initialized.  This allows me to build gdb.

OK to checkin?

Steve Ellcey
sellcey@imgtec.com




2015-12-01  Steve Ellcey  <sellcey@imgtec.com>

	* remote.c (remote_newthread_step): Initialize item.name.
	(remote_get_threads_with_qthreadinfo): Ditto.
  

Comments

Yao Qi Dec. 2, 2015, 8:47 a.m. UTC | #1
"Steve Ellcey " <sellcey@imgtec.com> writes:

> OK to checkin?
>

Yes, patch is OK to me.
  
Steve Ellcey Dec. 2, 2015, 4:35 p.m. UTC | #2
On Wed, 2015-12-02 at 08:47 +0000, Yao Qi wrote:
> "Steve Ellcey " <sellcey@imgtec.com> writes:
> 
> > OK to checkin?
> >
> 
> Yes, patch is OK to me.
> 

It looks like Ulrich already took care of this.  gdb is building for me
with the changes he checked in.

Steve Ellcey
sellcey@imgtec.com
  

Patch

diff --git a/gdb/remote.c b/gdb/remote.c
index 90be8b6..753241a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2904,6 +2904,7 @@  remote_newthread_step (threadref *ref, void *data)
   item.ptid = ptid_build (pid, threadref_to_int (ref), 0);
   item.core = -1;
   item.extra = NULL;
+  item.name = NULL;
 
   VEC_safe_push (thread_item_t, context->items, &item);
 
@@ -3069,6 +3070,7 @@  remote_get_threads_with_qthreadinfo (struct target_ops *ops,
 		  item.ptid = read_ptid (bufp, &bufp);
 		  item.core = -1;
 		  item.extra = NULL;
+		  item.name = NULL;
 
 		  VEC_safe_push (thread_item_t, context->items, &item);
 		}