2002-04-09 Daniel Jacobowitz <drow@mvista.com>
authorDaniel Jacobowitz <drow@false.org>
Tue, 9 Apr 2002 20:51:33 +0000 (20:51 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 9 Apr 2002 20:51:33 +0000 (20:51 +0000)
        * symtab.h (ALL_BLOCK_SYMBOLS): Don't dereference the pointer
        after the last symbol in a block.

gdb/ChangeLog
gdb/symtab.h

index eab7956c6161571ff1f8fef49cfd602a6f98f639..068424a471bf25dfa550be293b9272f6484b8880 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-09  Daniel Jacobowitz  <drow@mvista.com>
+
+       * symtab.h (ALL_BLOCK_SYMBOLS): Don't dereference the pointer
+       after the last symbol in a block.
+
 2002-04-09  Pierre Muller  <muller@ics.u-strasbg.fr>
 
        * p-exp.y (yylex): Handle also the fact that is_a_field_of_this
index f59e7a32040f03571904c66007cdae2e38fb5d58..ec1b058c55601ffe80698996402788116653e5c8 100644 (file)
@@ -407,11 +407,15 @@ struct block
 
 /* Macro to loop through all symbols in a block BL.
    i counts which symbol we are looking at, and sym points to the current
-   symbol.  */
+   symbol.
+   The contortion at the end is to avoid reading past the last valid
+   BLOCK_SYM.  */
 #define ALL_BLOCK_SYMBOLS(bl, i, sym)                  \
        for ((i) = 0, (sym) = BLOCK_SYM ((bl), (i));    \
             (i) < BLOCK_NSYMS ((bl));                  \
-            ++(i), (sym) = BLOCK_SYM ((bl), (i)))
+            ++(i), (sym) = ((i) < BLOCK_NSYMS ((bl)))  \
+                           ? BLOCK_SYM ((bl), (i))     \
+                           : NULL)
 
 /* Nonzero if symbols of block BL should be sorted alphabetically.
    Don't sort a block which corresponds to a function.  If we did the
This page took 0.038184 seconds and 4 git commands to generate.