https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105091

--- Comment #9 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
(In reply to Ian Lance Taylor from comment #8)
...
> 
> package main
> 
> func main() {
>       for _, test := range []struct {
>               x, y, want []int
>       }{
>               {[]int{}, []int{}, nil},
>               {[]int{0}, []int{0}, []int{0}},
>       } {
>               p := test.x
>               F(p)
>       }
> }
> 
> func F(v interface{}) {
>      recover()
>      println(cap(v.([]int)))
> }
> 
> This can be compiled (though not run) using a cross-compiler without
> building libgo.
> 
> The code coming into 280r.dse1 seems to be indexing from the end of the
> array.  I see
> 
> code_label 96 126 55 4 118 (nil) [0 uses])
> (note 55 96 56 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
> (insn 56 55 57 4 (set (reg:DI 144)
>         (mult:DI (reg:DI 121 [ ivtmp_47 ])
>             (const_int -72 [0xffffffffffffffb8]))) "foo.go":4:2 154 {muldi3}
>      (nil))
> (insn 57 56 59 4 (set (reg/f:DI 145)
>         (plus:DI (reg/f:DI 173)
>             (reg:DI 144))) "foo.go":4:2 66 {*adddi3}
>      (expr_list:REG_DEAD (reg/f:DI 173)
>         (expr_list:REG_DEAD (reg:DI 144)
>             (nil))))
> 
> where earlier I see
> 
> (insn 17 16 19 2 (set (mem/f/c:DI (plus:DI (reg/f:DI 110 sfp)
>                 (const_int 32 [0x20])) [8 GOTMP.5[0].x.__values+0 S8 A128])
>         (reg/f:DI 117 [ _11 ])) "foo.go":4:23 670 {*movdi_internal64}
>      (expr_list:REG_DEAD (reg/f:DI 117 [ _11 ])
>         (nil)))
> 
> and
> 
> (insn 120 4 121 2 (set (reg/f:DI 173)
>         (plus:DI (reg/f:DI 110 sfp)
>             (const_int 32 [0x20]))) 66 {*adddi3}
>      (nil))
> 
> So register 173 is &GOTMP.5 although insn 120 doesn't indicate that.  Then
> the 280r.dse1 pass drops out all the assignments to GOTMP.5, presumably
> because it doesn't understand that register 173 points to it.

Hi Ian!

Thanks for your great help!

Reply via email to