diff -r 45c35d829db9 -r 6156ee2b4e32 stage4/generate_iec/generate_iec.cc --- a/stage4/generate_iec/generate_iec.cc Thu Oct 25 18:12:51 2012 +0100 +++ b/stage4/generate_iec/generate_iec.cc Thu Oct 25 18:20:28 2012 +0100 @@ -1661,6 +1661,14 @@ /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ void *visit(il_expression_c *symbol) { + /* Since stage2 will insert an artificial (and equivalent) LD to the simple_instr_list when an 'il_operand' exists, we know + * that if (symbol->il_operand != NULL), then the first IL instruction in the simple_instr_list will be the equivalent and artificial + * 'LD ' IL instruction. + * Since we do not want the extra LD instruction, we simply remove it! + */ + if (symbol->il_operand != NULL) + ((list_c *)symbol->simple_instr_list)->remove_element(0); + symbol->il_expr_operator->accept(*this); s4o.print("("); if (symbol->il_operand != NULL)