On 11/15/2012 01:14 PM, Jakub Jelinek wrote:
Hi!

On the following testcase we ICE, because tree_ssa_dominator_optimize
modifies the bitmap while iterating it.  In particular, it contained just
a single bit in it, bitmap_clear_bit turned the bitmap into empty bitmap and
bitmap_set_bit on a lower bit reused the same bitmap_element with lower
index, but higher bit set in it, therefore EXECUTE_IF_SET_IN_BITMAP in next
iteration gave bit above highest basic block.

Fixed by never clearing any bits from the bitmap while traversing it,
it isn't IMHO a big deal, gimple_purge_all_dead_eh_edges will in a few
insns find out the forwarder block doesn't have any EDGE_EH edges and will
do nothing for it, on the other side to handle even chained forwarder blocks
it loops to find the last one.  Insertion of bits looks safe to me, we don't
care if those inserted bits are processed again or not (nothing will be done
for them anymore).

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-11-15  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/55329
        * tree-ssa-dom.c (tree_ssa_dominator_optimize): Never clear
        bits in needed_eh_cleanup while iterating over the bitmap.
        Look through all forwarder blocks at once.

        * g++.dg/opt/pr55329.C: New test.
This is fine.

I've still got a todo on my list from 2009 to have checking code to detect when a bitmap is changing while we're iterating on it.

jeff

Reply via email to