Patchwork Make gsi_remove return whether EH cleanup is required

login
register
mail settings
Submitter Richard Guenther
Date April 5, 2012, 11:30 a.m.
Message ID <CAFiYyc0fAqurTCf9jDS5ns+YYk9v-iWKkUhLtbsMhh3f2-Y3Aw@mail.gmail.com>
Download mbox | patch
Permalink /patch/150939/
State New
Headers show

Comments

Richard Guenther - April 5, 2012, 11:30 a.m.
On Thu, Apr 5, 2012 at 1:20 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> Richard Guenther <rguenther@suse.de> writes:
>
>> Several passes needlessly cleanup EH after gsi_remove because they do
>> not know whether the stmt was removed from EH regions.  The following
>> patch returns this information from gsi_remove and adjusts all users
>> I could find appropriately.
>
> I suspect this patch caused a go1 SEGV compiling the non-PIC
> libgo/exp/norm.o on i386-pc-solaris2.10:

Ah.  Try



>> /var/gcc/regression/trunk/10-gcc-gld/build/./gcc/gccgo -B/var/gcc/regression/trunk/10-gcc-gld/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.10/bin/ -B/vol/gcc/i386-pc-solaris2.10/lib/ -isystem /vol/gcc/i386-pc-solaris2.10/include -isystem /vol/gcc/i386-pc-solaris2.10/sys-include -minline-all-stringops -g -O2 -I . -c -fgo-prefix=libgo_exp /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/composition.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/forminfo.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/input.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/iter.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/normalize.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/readwriter.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/tables.go /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/trie.go -o exp/norm.o -save-temps
> /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/normalize.go: In function 'norm.decomposeToLastBoundary':
> /vol/gcc/src/hg/trunk/local/libgo/go/exp/norm/normalize.go:429:1: internal compiler error: Segmentation Fault
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1 (LWP 1)]
> 0x0852aefc in dse_optimize_stmt (gsi=...) at /vol/gcc/src/hg/trunk/local/gcc/tree-ssa-dse.c:262
> (gdb) where
> #0  0x0852aefc in dse_optimize_stmt (gsi=...) at /vol/gcc/src/hg/trunk/local/gcc/tree-ssa-dse.c:262
> #1  dse_enter_block (walk_data=0x8046ed0, bb=0xfe2c6640) at /vol/gcc/src/hg/trunk/local/gcc/tree-ssa-dse.c:278
> #2  0x08875e85 in walk_dominator_tree (walk_data=0x8046ed0, bb=0xfe2c6640) at /vol/gcc/src/hg/trunk/local/gcc/domwalk.c:188
> #3  0x0852a757 in tree_ssa_dse () at /vol/gcc/src/hg/trunk/local/gcc/tree-ssa-dse.c:313
> #4  0x0840cb64 in execute_one_pass (pass=pass@entry=0x8dbe8a0) at /vol/gcc/src/hg/trunk/local/gcc/passes.c:2079
> #5  0x0840cebd in execute_pass_list (pass=0x8dbe8a0) at /vol/gcc/src/hg/trunk/local/gcc/passes.c:2134
> #6  0x0840ced0 in execute_pass_list (pass=0x8dbe4e0) at /vol/gcc/src/hg/trunk/local/gcc/passes.c:2135
> #7  0x084ea0f6 in tree_rest_of_compilation (fndecl=0xfeb9d300) at /vol/gcc/src/hg/trunk/local/gcc/tree-optimize.c:422
> #8  0x08283417 in cgraph_expand_function (node=0xfebb599c) at /vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:1784
> #9  0x08284c55 in cgraph_expand_all_functions () at /vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:1851
> #10 cgraph_optimize () at /vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:2542
> #11 0x0828518f in cgraph_finalize_compilation_unit () at /vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:2628
> #12 0x081d117d in Gogo::write_globals (this=0x8f2f170) at /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/gogo-tree.cc:934
> #13 0x081cb343 in go_write_globals () at /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/go.cc:154
> #14 0x084a432b in compile_file () at /vol/gcc/src/hg/trunk/local/gcc/toplev.c:572
> #15 do_compile () at /vol/gcc/src/hg/trunk/local/gcc/toplev.c:1936
> #16 toplev_main (argc=26, argv=0x80471cc) at /vol/gcc/src/hg/trunk/local/gcc/toplev.c:2012
> #17 0x0819f3bb in main (argc=26, argv=0x80471cc) at /vol/gcc/src/hg/trunk/local/gcc/main.c:36
>
> Unfortunately, I cannot look into most of the variables used since gdb
> just shows them as `optimized out'.
>
> I'm just running a x86_64-unknown-linux-gnu bootstrap to check if it
> also occurs there.
>
>        Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
Rainer Orth - April 5, 2012, 11:54 a.m.
Richard Guenther <richard.guenther@gmail.com> writes:

> On Thu, Apr 5, 2012 at 1:20 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>> Richard Guenther <rguenther@suse.de> writes:
>>
>>> Several passes needlessly cleanup EH after gsi_remove because they do
>>> not know whether the stmt was removed from EH regions.  The following
>>> patch returns this information from gsi_remove and adjusts all users
>>> I could find appropriately.
>>
>> I suspect this patch caused a go1 SEGV compiling the non-PIC
>> libgo/exp/norm.o on i386-pc-solaris2.10:
>
> Ah.  Try
>
> Index: gcc/tree-ssa-dse.c
> ===================================================================
> --- gcc/tree-ssa-dse.c  (revision 186161)
> +++ gcc/tree-ssa-dse.c  (working copy)
> @@ -232,6 +232,8 @@ dse_optimize_stmt (gimple_stmt_iterator
>                                 gimple_get_lhs (use_stmt), 0)))
>           || stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt)))
>         {
> +         basic_block bb;
> +
>           /* If use_stmt is or might be a nop assignment, e.g. for
>              struct { ... } S a, b, *p; ...
>              b = a; b = b;
> @@ -258,8 +260,9 @@ dse_optimize_stmt (gimple_stmt_iterator
>           unlink_stmt_vdef (stmt);
>
>           /* Remove the dead store.  */
> +         bb = gimple_bb (stmt);
>           if (gsi_remove (&gsi, true))
> -           bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
> +           bitmap_set_bit (need_eh_cleanup, bb->index);
>
>           /* And release any SSA_NAMEs set in this statement back to the
>              SSA_NAME manager.  */
>

Works fine on x86_64-unknown-linux-gnu, where the failure happened as
well.

Thanks.
        Rainer

Patch

Index: gcc/tree-ssa-dse.c
===================================================================
--- gcc/tree-ssa-dse.c  (revision 186161)
+++ gcc/tree-ssa-dse.c  (working copy)
@@ -232,6 +232,8 @@  dse_optimize_stmt (gimple_stmt_iterator
                                gimple_get_lhs (use_stmt), 0)))
          || stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt)))
        {
+         basic_block bb;
+
          /* If use_stmt is or might be a nop assignment, e.g. for
             struct { ... } S a, b, *p; ...
             b = a; b = b;
@@ -258,8 +260,9 @@  dse_optimize_stmt (gimple_stmt_iterator
          unlink_stmt_vdef (stmt);

          /* Remove the dead store.  */
+         bb = gimple_bb (stmt);
          if (gsi_remove (&gsi, true))
-           bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
+           bitmap_set_bit (need_eh_cleanup, bb->index);

          /* And release any SSA_NAMEs set in this statement back to the
             SSA_NAME manager.  */