public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [OBV] Fix compilation failure inn rs6000-aix-tdep.c
@ 2010-04-21  8:45 Pierre Muller
  2010-04-21 14:11 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Muller @ 2010-04-21  8:45 UTC (permalink / raw)
  To: gdb-patches

gcc-4.1.2
chokes at
cc1: warnings being treated as errors
/home/muller/auto-test-gdb/gdb/gdb/rs6000-aix-tdep.c: In function
'rs6000_convert_from_func_ptr_addr':
/home/muller/auto-test-gdb/gdb/gdb/rs6000-aix-tdep.c:586: warning: 'pc' may
be used uninitialized in this function

This is because 'pc' is initialized in a TRY_CATCH
which itself consists of two while statements
so that the statement after TRY_CATCH is
not surely executed (at least from the gcc point of view).

 This compilation failure is trivially 
fixed by setting pc to zero first.

  Checked in as obvious,

Pierre Muller

ChangeLog entry:

2010-04-21  Pierre Muller  <muller@ics.u-strasbg.fr>

       Fix compilation warning on gcc-4.1.2.
       * rs6000-aix-tdep.c (rs6000_convert_from_func_ptr_addr): Initialize
       local variable`pc' to zero.

Index: rs6000-aix-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-aix-tdep.c,v
retrieving revision 1.17
diff -u -p -r1.17 rs6000-aix-tdep.c
--- rs6000-aix-tdep.c   20 Apr 2010 22:38:53 -0000      1.17
+++ rs6000-aix-tdep.c   21 Apr 2010 08:43:16 -0000
@@ -583,7 +583,7 @@ rs6000_convert_from_func_ptr_addr (struc
      the target address itself points to a section that is executable.  */
   if (s && (s->the_bfd_section->flags & SEC_CODE) == 0)
     {
-      CORE_ADDR pc;
+      CORE_ADDR pc = 0;
       struct obj_section *pc_section;
       struct gdb_exception e;

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

* Re: [OBV] Fix compilation failure inn rs6000-aix-tdep.c
  2010-04-21  8:45 [OBV] Fix compilation failure inn rs6000-aix-tdep.c Pierre Muller
@ 2010-04-21 14:11 ` Joel Brobecker
  2010-04-21 15:33   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2010-04-21 14:11 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

> cc1: warnings being treated as errors
> /home/muller/auto-test-gdb/gdb/gdb/rs6000-aix-tdep.c: In function
> 'rs6000_convert_from_func_ptr_addr':
> /home/muller/auto-test-gdb/gdb/gdb/rs6000-aix-tdep.c:586: warning: 'pc' may
> be used uninitialized in this function

Gaaah - I am 150% sure that I rebuilt this file before committing :-(.
Thanks for fixing.

-- 
Joel

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

* Re: [OBV] Fix compilation failure inn rs6000-aix-tdep.c
  2010-04-21 14:11 ` Joel Brobecker
@ 2010-04-21 15:33   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2010-04-21 15:33 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pierre Muller, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

>> cc1: warnings being treated as errors
>> /home/muller/auto-test-gdb/gdb/gdb/rs6000-aix-tdep.c: In function
>> 'rs6000_convert_from_func_ptr_addr':
>> /home/muller/auto-test-gdb/gdb/gdb/rs6000-aix-tdep.c:586: warning: 'pc' may
>> be used uninitialized in this function

Joel> Gaaah - I am 150% sure that I rebuilt this file before committing :-(.

This error is probably GCC version- and option-dependent.
So, don't worry about it.

Tom

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

end of thread, other threads:[~2010-04-21 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21  8:45 [OBV] Fix compilation failure inn rs6000-aix-tdep.c Pierre Muller
2010-04-21 14:11 ` Joel Brobecker
2010-04-21 15:33   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).