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]

[OBV] Fix compilation failure inn rs6000-aix-tdep.c


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;


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