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]

[ob] Fix warning with GCC HEAD


GCC HEAD complains about an uninitialized variable in
evaluate_subexp_standard.  It turns out that if calc_f77_array_dims
reports that the array has zero dimensions, then subscript_array will
be used uninitialized - in fact, it will be used with subscript -1,
too.  So I added an assertion to prevent us getting there if something
goes wrong with the parser and with the debug info.

Tested on i686-linux with GCC HEAD and on x86_64-linux with GCC 4.3,
and checked in.

-- 
Daniel Jacobowitz
CodeSourcery

2008-11-04  Daniel Jacobowitz  <dan@codesourcery.com>

	* eval.c (evaluate_subexp_standard): Assert that there is at
	least one array dimension.

Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.101
diff -u -p -r1.101 eval.c
--- eval.c	28 Oct 2008 17:19:56 -0000	1.101
+++ eval.c	4 Nov 2008 14:51:18 -0000
@@ -1976,6 +1976,8 @@ evaluate_subexp_standard (struct type *e
 	if (nargs != ndimensions)
 	  error (_("Wrong number of subscripts"));
 
+	gdb_assert (nargs > 0);
+
 	/* Now that we know we have a legal array subscript expression 
 	   let us actually find out where this element exists in the array. */
 


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