Committed, MMIX: Fix invalid access in tc-mmix.c:get_putget_operands
Hans-Peter Nilsson
hp@bitrange.com
Sun Nov 10 10:40:00 GMT 2002
Another valgrind catch, test-case gas/mmix/err-builtin.s. With syntax
error in input, either operand could be uninitialized.
* config/tc-mmix.c (get_putget_operands): Mark both possible
operands as invalid at beginning.
Index: tc-mmix.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mmix.c,v
retrieving revision 1.11
diff -p -c -r1.11 tc-mmix.c
*** tc-mmix.c 10 Nov 2002 13:09:11 -0000 1.11
--- tc-mmix.c 10 Nov 2002 18:29:39 -0000
*************** get_putget_operands (insn, operands, exp
*** 542,547 ****
--- 542,552 ----
input_line_pointer = p;
+ /* Initialize both possible operands to error state, in case we never
+ get further. */
+ exp[0].X_op = O_illegal;
+ exp[1].X_op = O_illegal;
+
if (insn->operands == mmix_operands_get)
{
expp_reg = &exp[0];
*************** get_putget_operands (insn, operands, exp
*** 572,581 ****
{
expp_sreg = &exp[0];
expp_reg = &exp[1];
-
- /* Initialize to error state in case we'll never call expression on
- this operand. */
- expp_reg->X_op = O_illegal;
sregp = p;
c = get_symbol_end ();
--- 577,582 ----
brgds, H-P
More information about the Binutils
mailing list