Bug 18712 - [4.0 Regression] ICE: vector VEC(basic_block) push domain error, in insert_phi_nodes_for at tree-into-ssa.c:1049
Summary: [4.0 Regression] ICE: vector VEC(basic_block) push domain error, in insert_ph...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 critical
Target Milestone: 4.0.0
Assignee: Diego Novillo
URL:
Keywords: ice-on-valid-code
: 18719 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-29 07:02 UTC by Serge Belyshev
Modified: 2004-11-29 20:15 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-11-29 08:03:36


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Belyshev 2004-11-29 07:02:07 UTC
use '-O1':
----------------------------------------------------------------------------------------
void *eintr_source (void *arg)
{
  int ts = 0;
  
  if (arg)
    foo ();
  
  while (1)
    {
      if (arg)
	foo ();
      
      foo1 (&ts);
    }
  
  return 0;
}
----------------------------------------------------------------------------------------
Comment 1 Serge Belyshev 2004-11-29 08:03:35 UTC
Introduced by this patch:

2004-11-23  Diego Novillo  <dnovillo@redhat.com>

	PR tree-optimization/18618
	* tree-into-ssa.c (DEF_VEC_MALLOC_P(basic_block)): Declare.
	(insert_phi_nodes_for): Change third argument to VEC(basic_block).
Comment 2 Andreas Jaeger 2004-11-29 09:58:46 UTC
The same error occurs for me on Linux/ia64 and Linux/x86-64. 
 
Diego, this seems to have been introduced by one of your patches.  Could 
you look at it, please? 
Comment 3 Steven Bosscher 2004-11-29 10:21:18 UTC
Try this. 
 
Index: tree-into-ssa.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v 
retrieving revision 2.33 
diff -u -3 -p -r2.33 tree-into-ssa.c 
--- tree-into-ssa.c     25 Nov 2004 22:31:08 -0000      2.33 
+++ tree-into-ssa.c     29 Nov 2004 10:21:04 -0000 
@@ -1017,7 +1017,7 @@ insert_phi_nodes_for (tree var, bitmap * 
 
   EXECUTE_IF_SET_IN_BITMAP (def_map->def_blocks, 0, bb_index, bi) 
     { 
-      VEC_quick_push (basic_block, work_stack, BASIC_BLOCK (bb_index)); 
+      VEC_safe_push (basic_block, work_stack, BASIC_BLOCK (bb_index)); 
     } 
 
   /* Pop a block off the worklist, add every block that appears in 
@@ -1046,7 +1046,7 @@ insert_phi_nodes_for (tree var, bitmap * 
        { 
          basic_block bb = BASIC_BLOCK (dfs_index); 
 
-         VEC_quick_push (basic_block, work_stack, bb); 
+         VEC_safe_push (basic_block, work_stack, bb); 
          bitmap_set_bit (phi_insertion_points, dfs_index); 
        } 
     } 
 
Comment 4 Andrew Pinski 2004-11-29 13:37:03 UTC
Steven's patch should work ...
Comment 5 Diego Novillo 2004-11-29 13:42:31 UTC
Subject: Re:  [4.0 Regression] ICE: vector
	VEC(basic_block) push domain error, in insert_phi_nodes_for at
	tree-into-ssa.c:1049

On Mon, 2004-11-29 at 13:37 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-29 13:37 -------
> Steven's patch should work ...
> 
But it should not be necessary.  One thing that needs to change, however
is:

--- tree-into-ssa.c     25 Nov 2004 22:31:08 -0000      2.33
+++ tree-into-ssa.c     29 Nov 2004 13:40:34 -0000
@@ -614,7 +614,7 @@ insert_phi_nodes (bitmap *dfs, bitmap na

   /* Vector WORK_STACK is a stack of CFG blocks.  Each block that contains
      an assignment or PHI node will be pushed to this stack.  */
-  work_stack = VEC_alloc (basic_block, last_basic_block);
+  work_stack = VEC_alloc (basic_block, n_basic_blocks);

   /* Iterate over all variables in VARS_TO_RENAME.  For each variable, add
      to the work list all the blocks that have a definition for the


But that is not sufficient.  We are overflowing work_stack, when we really
shouldn't.  I'm looking into this now.


Diego.

Comment 6 Andrew Pinski 2004-11-29 16:24:20 UTC
*** Bug 18719 has been marked as a duplicate of this bug. ***
Comment 7 Diego Novillo 2004-11-29 19:20:35 UTC
(In reply to comment #5)

> But that is not sufficient.  We are overflowing work_stack, when we really
> shouldn't.  I'm looking into this now.
> 
I was wrong.  It is indeed possible for WORK_STACK to have more than
N_BASIC_BLOCKS used.  For each block B with a definition for VAR, we add blocks
in B's DFS to the stack.  Steven's patch is almost right, but we also need to
pass WORK_STACK by reference.

Patch in testing.


Diego.
Comment 8 Diego Novillo 2004-11-29 20:15:48 UTC
Fix: http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02593.html