re PR middle-end/25990 (gomp ICE with -fopenmp)
authorDiego Novillo <dnovillo@redhat.com>
Thu, 2 Feb 2006 12:27:02 +0000 (12:27 +0000)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Thu, 2 Feb 2006 12:27:02 +0000 (07:27 -0500)
PR 25990
* 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.

From-SVN: r110511

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

index a4d94fe1d296132e8da12de34a0f2cfb18970658..d39dfc8f4fa6849018fac730ccfee1902f76d2cf 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
index cb357c5ca68db4166351af195d9b868af100d4dd..5d4cff5ee9954deca2258cd5dfc3ba50cb644372 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
index f76f663ef695dca9841a1b495b8bcf7feb0172b2..9ba761dcf4a91259a01812fca72ef8f5e44a577b 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;
-  unsigned sz;
+  unsigned old_len, new_len;
+  basic_block *addr;
 
   /* 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;
 
-  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,
@@ -4708,7 +4711,6 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
 
       if (TREE_CODE (stmt) == LABEL_EXPR)
        {
-         unsigned old_len;
          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)
            {
-             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);