use '-O1': ---------------------------------------------------------------------------------------- void *eintr_source (void *arg) { int ts = 0; if (arg) foo (); while (1) { if (arg) foo (); foo1 (&ts); } return 0; } ----------------------------------------------------------------------------------------
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).
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?
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); } }
Steven's patch should work ...
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.
*** Bug 18719 has been marked as a duplicate of this bug. ***
(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.
Fix: http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02593.html