Branch: Tag:

2006-03-02

2006-03-02 10:25:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fix for the bug noted in LysLysKOM 14180500, where reused local variables weren't cleared properly.

Rev: src/docode.c:1.186
Rev: src/language.yacc:1.368
Rev: src/las.c:1.375

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: docode.c,v 1.185 2006/02/27 12:07:09 mast Exp $ + || $Id: docode.c,v 1.186 2006/03/02 10:24:47 grubba Exp $   */      #include "global.h"
1048:       if(CDR(n)->u.integer.b) goto normal_assign;    +  if (CDR(n)->node_info & OPT_ASSIGNMENT) { +  /* Initialize. */ +  emit0(F_CONST0); +  emit1(F_ASSIGN_LOCAL_AND_POP, CDR(n)->u.integer.a); +  }    code_expression(CAR(n), 0, "RHS");    emit1(flags & DO_POP ? F_ASSIGN_LOCAL_AND_POP:F_ASSIGN_LOCAL,    CDR(n)->u.integer.a );
2288:    {    if(flags & WANT_LVALUE)    { -  emit2(F_LEXICAL_LOCAL_LVALUE,n->u.id.number,n->u.integer.b); +  emit2(F_LEXICAL_LOCAL_LVALUE, n->u.integer.a, n->u.integer.b);    return 2;    }else{ -  emit2(F_LEXICAL_LOCAL,n->u.id.number,n->u.integer.b); +  emit2(F_LEXICAL_LOCAL, n->u.integer.a, n->u.integer.b);    return 1;    }    }else{    if(flags & WANT_LVALUE)    { -  emit1(F_LOCAL_LVALUE,n->u.id.number); +  if (n->node_info & OPT_ASSIGNMENT) { +  /* Initialize the variable. */ +  emit0(F_CONST0); +  emit1(F_ASSIGN_LOCAL_AND_POP, n->u.integer.a); +  } +  emit1(F_LOCAL_LVALUE, n->u.integer.a);    return 2;    }else{ -  emit1(F_LOCAL,n->u.id.number); +  if (n->node_info & OPT_ASSIGNMENT) { +  /* Initialize the variable. */ +  emit0(F_CONST0); +  emit1(F_ASSIGN_LOCAL, n->u.integer.a); +  } else { +  emit1(F_LOCAL, n->u.integer.a); +  }    return 1;    }    }