fix do_while
authorMatthias Braun <matze@braunis.de>
Wed, 25 Jun 2008 08:32:01 +0000 (08:32 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 25 Jun 2008 08:32:01 +0000 (08:32 +0000)
[r20253]

ast2firm.c

index d05e76d..97814fc 100644 (file)
@@ -4149,21 +4149,17 @@ static void do_while_statement_to_firm(do_while_statement_t *statement)
                add_immBlock_pred(body_block, jmp);
        }
 
-       ir_node *false_block = NULL;
-
-       if (statement->body != NULL) {
-               ir_node *old_continue_label = continue_label;
-               ir_node *old_break_label    = break_label;
-               continue_label              = header_block;
-               break_label                 = false_block;
+       ir_node *old_continue_label = continue_label;
+       ir_node *old_break_label    = break_label;
+       continue_label              = header_block;
+       break_label                 = NULL;
 
-               statement_to_firm(statement->body);
-               false_block = break_label;
+       statement_to_firm(statement->body);
+       ir_node *false_block = break_label;
 
-               assert(continue_label == header_block);
-               continue_label = old_continue_label;
-               break_label    = old_break_label;
-       }
+       assert(continue_label == header_block);
+       continue_label = old_continue_label;
+       break_label    = old_break_label;
 
        if (get_cur_block() != NULL) {
                ir_node *body_jmp = new_Jmp();
@@ -4171,6 +4167,10 @@ static void do_while_statement_to_firm(do_while_statement_t *statement)
                mature_immBlock(header_block);
        }
 
+       if (false_block == NULL) {
+               false_block = new_immBlock();
+       }
+
        /* create the condition */
        set_cur_block(header_block);