Hi, The error is rectified. The bug is in the function that calls fuse_loops(). Now I am trying to transfer all the statements, using code -
/* The following function fuses two loops. */ void fuse_loops (struct loop *loop_a, struct loop *loop_b) { debug_loop (loop_a, 10); debug_loop (loop_b, 10); block_stmt_iterator bsi_a = bsi_start (loop_a->header); block_stmt_iterator bsi_a_last = bsi_last (loop_a->header); block_stmt_iterator bsi_b = bsi_last (loop_b->header); while (&bsi_a != &bsi_a_last) { bsi_move_before (&bsi_a, &bsi_b); fprintf (stderr, " transferred one statement from loop %d to loop %d ", loop_a->num, loop_b->num); bsi_next (&bsi_a); } debug_loop (loop_a, 10); debug_loop (loop_b, 10); cancel_loop_tree (loop_a); } After doing this I get a segmentation fault , after 3 statements of loop_a are transferred to loop_b. Program received signal SIGSEGV, Segmentation fault. 0x08436245 in tsi_next (i=0xbffff5b0) at ../../trunk/gcc/tree-iterator.h:74 74 i->ptr = i->ptr->next; Thanks, Sandeep. On Thu, Apr 10, 2008 at 5:57 PM, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > Hi, > > > > I have written this function > > > > /* The following function fuses two loops. */ > > > > void > > fuse_loops (struct loop *loop_a, struct loop *loop_b) > > { > > debug_loop (loop_a, 10); > > debug_loop (loop_b, 10); > > block_stmt_iterator bsi_a = bsi_start (loop_a->header); > > block_stmt_iterator bsi_b = bsi_last (loop_b->header); > > bsi_move_before (&bsi_a, &bsi_b); > > fprintf (stderr, " transferred one statement from loop %d to loop %d > > ", loop_a->num, loop_b->num); > > debug_loop (loop_a, 10); > > debug_loop (loop_b, 10); > > cancel_loop_tree (loop_a); > > } > > > > It moved one statement from loop_a to loop_b. In the same way I must > > tranfer all other statements too. I get a internal compiler error at " > > cancel_loop_tree(loop_a); " > > where exactly (can you send me a backtrace)? It does not seem possible > for cancel_loop_tree to ICE, if fuse_loops is the only function that you > call. > > Zdenek >