Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] make older gcc happy mips-tdep.c
@ 2012-12-19 17:55 Andreas Tobler
  2012-12-19 19:16 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Tobler @ 2012-12-19 17:55 UTC (permalink / raw)
  To: gdb-patches

Hello,

while trying to build a gdb with --enable-targets=all I found the below.

The warning is about 'branch_bp might be uninitialized...'

I compile this on FreeBSD where the system compiler is gcc-4.2.1.

Is the below ok to commit?

TIA,
Andreas

2012-12-19  Andreas Tobler  <andreast@neon.andreas.nets>

	* mips-tdep.c (mips_deal_with_atomic_sequence): Initialize
	branch_bp to keep gcc happy.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.564
diff -u -r1.564 mips-tdep.c
--- mips-tdep.c 12 Nov 2012 21:59:07 -0000      1.564
+++ mips-tdep.c 19 Dec 2012 17:51:35 -0000
@@ -3695,7 +3695,8 @@
 {
   CORE_ADDR breaks[2] = {-1, -1};
   CORE_ADDR loc = pc;
-  CORE_ADDR branch_bp; /* Breakpoint at branch instruction's
destination.  */
+  CORE_ADDR branch_bp = 0; /* Breakpoint at branch instruction's
+                             destination.  */
   ULONGEST insn;
   int insn_count;
   int index;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] make older gcc happy mips-tdep.c
  2012-12-19 17:55 [patch] make older gcc happy mips-tdep.c Andreas Tobler
@ 2012-12-19 19:16 ` Tom Tromey
  2012-12-19 20:09   ` Andreas Tobler
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2012-12-19 19:16 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: gdb-patches

>>>>> "Andreas" == Andreas Tobler <andreast-list@fgznet.ch> writes:

Andreas> 2012-12-19  Andreas Tobler  <andreast@neon.andreas.nets>

Andreas> 	* mips-tdep.c (mips_deal_with_atomic_sequence): Initialize
Andreas> 	branch_bp to keep gcc happy.

This is ok, but I'm pretty surprised that the problem is here and not in
micromips_deal_with_atomic_sequence.  The latter looks more like the
kind of usage that would provoke warnings from gcc.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] make older gcc happy mips-tdep.c
  2012-12-19 19:16 ` Tom Tromey
@ 2012-12-19 20:09   ` Andreas Tobler
  2012-12-19 20:47     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Tobler @ 2012-12-19 20:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Hi Tom!

On 19.12.12 20:15, Tom Tromey wrote:
>>>>>> "Andreas" == Andreas Tobler <andreast-list@fgznet.ch> writes:
> 
> Andreas> 2012-12-19  Andreas Tobler  <andreast@neon.andreas.nets>
> 
> Andreas> 	* mips-tdep.c (mips_deal_with_atomic_sequence): Initialize
> Andreas> 	branch_bp to keep gcc happy.
> 
> This is ok, but I'm pretty surprised that the problem is here and not in
> micromips_deal_with_atomic_sequence.  The latter looks more like the
> kind of usage that would provoke warnings from gcc.

Your surprise is correct! I did something wrong. I have wrongly applied
the patch from my git repo to the cvs repo. A rebuild with the cvs repo
showed that you are absolutely correct.

Thank you very much.

I'll commit the below if ok.

Andreas

2012-12-19  Andreas Tobler  <andreast@neon.andreas.nets>

	* mips-tdep.c (micromips_deal_with_atomic_sequence): Initialize
	branch_bp to keep gcc happy.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.564
diff -u -r1.564 mips-tdep.c
--- mips-tdep.c	12 Nov 2012 21:59:07 -0000	1.564
+++ mips-tdep.c	19 Dec 2012 20:05:21 -0000
@@ -3796,7 +3796,8 @@
   const int atomic_sequence_length = 16; /* Instruction sequence
length.  */
   int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed).  */
   CORE_ADDR breaks[2] = {-1, -1};
-  CORE_ADDR branch_bp; /* Breakpoint at branch instruction's
destination.  */
+  CORE_ADDR branch_bp = 0; /* Breakpoint at branch instruction's
+			      destination.  */
   CORE_ADDR loc = pc;
   int sc_found = 0;
   ULONGEST insn;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] make older gcc happy mips-tdep.c
  2012-12-19 20:09   ` Andreas Tobler
@ 2012-12-19 20:47     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2012-12-19 20:47 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: gdb-patches

>>>>> "Andreas" == Andreas Tobler <andreast-list@fgznet.ch> writes:

Andreas> I'll commit the below if ok.

Yes, it is ok.
Thanks.

Andreas> 2012-12-19  Andreas Tobler  <andreast@neon.andreas.nets>

Andreas> 	* mips-tdep.c (micromips_deal_with_atomic_sequence): Initialize
Andreas> 	branch_bp to keep gcc happy.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-19 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 17:55 [patch] make older gcc happy mips-tdep.c Andreas Tobler
2012-12-19 19:16 ` Tom Tromey
2012-12-19 20:09   ` Andreas Tobler
2012-12-19 20:47     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox