re PR fortran/53148 (Incorrect intrinsic function parsing on labeled statements when...
[gcc.git] / gcc / fortran / frontend-passes.c
index b20dabbd33b24d432806b9574b7f992c1c52eef7..92a3f8fb3b273f5bc7eb500cfc36a1fdbdb05bb7 100644 (file)
@@ -271,6 +271,16 @@ create_var (gfc_expr * e)
       inserted_block->ext.block.assoc = NULL;
 
       ns->code = *current_code;
+
+      /* If the statement has a label,  make sure it is transferred to
+        the newly created block.  */
+
+      if ((*current_code)->here) 
+       {
+         inserted_block->here = (*current_code)->here;
+         (*current_code)->here = NULL;
+       }
+
       inserted_block->next = (*current_code)->next;
       changed_statement = &(inserted_block->ext.block.ns->code);
       (*current_code)->next = NULL;