OSDN Git Service

* trans-stmt.c (gfc_trans_goto): Jump to the known label instead
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 31 Jul 2005 20:36:47 +0000 (20:36 +0000)
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 31 Jul 2005 20:36:47 +0000 (20:36 +0000)
of the assigned goto variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102607 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c

index 9147a22..f64e743 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-31  Steven Bosscher  <stevenb@suse.de>
+
+       * trans-stmt.c (gfc_trans_goto): Jump to the known label instead
+       of the assigned goto variable.
+
 2005-07-29  Steven Bosscher  <stevenb@suse.de>
 
        * trans-types.h (gfc_array_range_type): Add missing GTY decl for this.
index 99467b4..72407ae 100644 (file)
@@ -163,11 +163,11 @@ gfc_trans_goto (gfc_code * code)
   gfc_trans_runtime_check (tmp, assign_error, &se.pre);
 
   assigned_goto = GFC_DECL_ASSIGN_ADDR (se.expr);
-  target = build1 (GOTO_EXPR, void_type_node, assigned_goto);
 
   code = code->block;
   if (code == NULL)
     {
+      target = build1 (GOTO_EXPR, void_type_node, assigned_goto);
       gfc_add_expr_to_block (&se.pre, target);
       return gfc_finish_block (&se.pre);
     }
@@ -177,10 +177,12 @@ gfc_trans_goto (gfc_code * code)
 
   do
     {
-      tmp = gfc_get_label_decl (code->label);
-      tmp = gfc_build_addr_expr (pvoid_type_node, tmp);
+      target = gfc_get_label_decl (code->label);
+      tmp = gfc_build_addr_expr (pvoid_type_node, target);
       tmp = build2 (EQ_EXPR, boolean_type_node, tmp, assigned_goto);
-      tmp = build3_v (COND_EXPR, tmp, target, build_empty_stmt ());
+      tmp = build3_v (COND_EXPR, tmp,
+                     build1 (GOTO_EXPR, void_type_node, target),
+                     build_empty_stmt ());
       gfc_add_expr_to_block (&se.pre, tmp);
       code = code->block;
     }