Branch: Tag:

2007-06-11

2007-06-11 16:13:27 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fixed case where the += opcode can zap lvalues.

Rev: src/interpret_functions.h:1.194

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret_functions.h,v 1.193 2006/08/15 10:43:25 grubba Exp $ + || $Id: interpret_functions.h,v 1.194 2007/06/11 16:13:27 grubba Exp $   */      /*
720:   });      OPCODE0(F_ADD_TO, "+=", I_UPDATE_SP, { +  ONERROR uwp;    move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type=PIKE_T_INT;    Pike_sp++;
775:    goto add_to_done;    }    } +  /* NOTE: Pike_sp-4 is the lvalue, Pike_sp-2 is the original value. +  * If an error gets thrown, the original value will thus be restored. +  * If f_add() succeeds, Pike_sp-2 will hold the result. +  */ +  SET_ONERROR(uwp, o_assign_lvalue, Pike_sp-4);    f_add(2); -  assign_lvalue(Pike_sp-3,Pike_sp-1); +  CALL_AND_UNSET_ONERROR(uwp); /* assign_lvalue(Pike_sp-3,Pike_sp-1); */    stack_pop_2_elems_keep_top();    add_to_done:    ; /* make gcc happy */