OSDN Git Service

PR 25990
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2006 12:27:02 +0000 (12:27 +0000)
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2006 12:27:02 +0000 (12:27 +0000)
* tree-cfg.c (move_block_to_fn): Clear out the basic block
array after growing it.

testsuite/

PR 25990
* gcc.dg/gomp/pr25990.c: New test.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-cfg.c

index a4d94fe..d39dfc8 100644 (file)
@@ -1,3 +1,9 @@
+2006-02-02  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 25990
+       * tree-cfg.c (move_block_to_fn): Clear out the basic block
+       array after growing it.
+
 2006-02-01  Steve Ellcey  <sje@cup.hp.com>
 
        PR middle-end/24901
 2006-02-01  Steve Ellcey  <sje@cup.hp.com>
 
        PR middle-end/24901
index cb357c5..5d4cff5 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-02  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 25990
+       * gcc.dg/gomp/pr25990.c: New test.
+
 2006-01-31  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/25342
 2006-01-31  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/25342
index f76f663..9ba761d 100644 (file)
@@ -4656,7 +4656,8 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
   edge e;
   block_stmt_iterator si;
   struct move_stmt_d d;
   edge e;
   block_stmt_iterator si;
   struct move_stmt_d d;
-  unsigned sz;
+  unsigned old_len, new_len;
+  basic_block *addr;
 
   /* Link BB to the new linked list.  */
   move_block_after (bb, after);
 
   /* Link BB to the new linked list.  */
   move_block_after (bb, after);
@@ -4679,11 +4680,13 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
   if (bb->index > cfg->x_last_basic_block)
     cfg->x_last_basic_block = bb->index;
 
   if (bb->index > cfg->x_last_basic_block)
     cfg->x_last_basic_block = bb->index;
 
-  sz = VEC_length (basic_block, cfg->x_basic_block_info);
-  if ((unsigned) cfg->x_last_basic_block >= sz)
+  old_len = VEC_length (basic_block, cfg->x_basic_block_info);
+  if ((unsigned) cfg->x_last_basic_block >= old_len)
     {
     {
-      sz = cfg->x_last_basic_block + (cfg->x_last_basic_block + 3) / 4;
-      VEC_safe_grow (basic_block, gc, cfg->x_basic_block_info, sz);
+      new_len = cfg->x_last_basic_block + (cfg->x_last_basic_block + 3) / 4;
+      VEC_safe_grow (basic_block, gc, cfg->x_basic_block_info, new_len);
+      addr = VEC_address (basic_block, cfg->x_basic_block_info);
+      memset (&addr[old_len], 0, sizeof (basic_block) * (new_len - old_len));
     }
 
   VEC_replace (basic_block, cfg->x_basic_block_info,
     }
 
   VEC_replace (basic_block, cfg->x_basic_block_info,
@@ -4708,7 +4711,6 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
 
       if (TREE_CODE (stmt) == LABEL_EXPR)
        {
 
       if (TREE_CODE (stmt) == LABEL_EXPR)
        {
-         unsigned old_len;
          tree label = LABEL_EXPR_LABEL (stmt);
          int uid = LABEL_DECL_UID (label);
 
          tree label = LABEL_EXPR_LABEL (stmt);
          int uid = LABEL_DECL_UID (label);
 
@@ -4717,8 +4719,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
          old_len = VEC_length (basic_block, cfg->x_label_to_block_map);
          if (old_len <= (unsigned) uid)
            {
          old_len = VEC_length (basic_block, cfg->x_label_to_block_map);
          if (old_len <= (unsigned) uid)
            {
-             basic_block *addr;
-             unsigned new_len = 3 * uid / 2;
+             new_len = 3 * uid / 2;
              VEC_safe_grow (basic_block, gc, cfg->x_label_to_block_map,
                             new_len);
              addr = VEC_address (basic_block, cfg->x_label_to_block_map);
              VEC_safe_grow (basic_block, gc, cfg->x_label_to_block_map,
                             new_len);
              addr = VEC_address (basic_block, cfg->x_label_to_block_map);