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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I already get

> ./xg++ -B. -nostdlib -fPIC -flto -shared t.ii -O2 -g
t.ii: In function ‘float_next_imp’:
t.ii:33:7: error: address taken, but ADDRESSABLE bit not set
       float_next_imp (T p1, Policy p2)
       ^
d
t.ii:38:4: note: in statement
    frexp (p1, &d);
    ^
# .MEM_13 = VDEF <.MEM_11>
frexp (p1_5(D), &d);
t.ii:33:7: internal compiler error: verify_gimple failed
       float_next_imp (T p1, Policy p2)
       ^
0xaf39de verify_gimple_in_cfg(function*)


Ok.  It is the execute_update_addresses_taken () call in the TODO of the
IPA inline transform pass that re-sets TREE_ADDRESSABLE here.  Somehow
we have merged 'd' from two different places it seems (the optimization
is in _GLOBAL__sub_I_t.ii).

The duplicate appears in _GLOBAL__sub_I_t.ii after inlining:



        { Scope block #21 t.ii:13 Originating from :  static long doubleD.2801
get_min_shift_valueD.2829 (void);

          { Scope block #23 Originating from :#0
            voidD.2802 <<< Unknown tree: imported_decl >>> = ldexpD.2839;
            intD.2788 dD.2905; (nonlocalized)
...
_GLOBAL__sub_I_t.ii ()
{
...
}

...

float_next_imp (intD.2788 p1D.2902, struct AD.2830 p2D.2903)
{
  struct AD.2830 D.2919;
  intD.2788 D.2918;
  const intD.2833 ISRA.9D.2915;
  intD.2788 dD.2905;
  const intD.2833 D.2904;


something is messed up.  The decl is streamed via streaming struct function
local-decls from float_next_imp (as expected).  No idea how it ends up in
the vars for _GLOBAL__sub_I_t.ii.

Ah.  We inline

(gdb) p debug_gimple_stmt (stmt)
# .MEM = VDEF <.MEM>
get_min_shift_value ();
$91 = void

but somehow we end up with

(gdb) p debug_tree (old_var)
 <var_decl 0x7ffff683c8e8 d
    type <integer_type 0x7ffff66b2690 int asm_written public SI
        size <integer_cst 0x7ffff66b53a0 constant 32>
        unit size <integer_cst 0x7ffff66b53c0 constant 4>
        align 32 symtab -159219552 alias set -1 canonical type 0x7ffff66b2690
precision 32 min <integer_cst 0x7ffff66b5340 -2147483648> max <integer_cst
0x7ffff66b5360 2147483647>
        pointer_to_this <pointer_type 0x7ffff66bd738>>
    addressable SI file t.ii line 36 col 8 size <integer_cst 0x7ffff66b53a0 32>
unit size <integer_cst 0x7ffff66b53c0 4>
    align 32 context <function_decl 0x7ffff6821b00 float_next_imp>>

in its BLOCK tree.  Which gets populated by

Old value = <tree 0x0>
New value = <block 0x7ffff6828fa0>
0x0000000000cd9194 in lto_input_ts_block_tree_pointers (ib=0x7fffffffd610, 
    data_in=0x1bee6a0, expr=<block 0x7ffff6828fa0>)
    at /space/rguenther/src/svn/gcc-4_9-branch/gcc/tree-streamer-in.c:928
928           BLOCK_SUBBLOCKS (BLOCK_SUPERCONTEXT (expr)) = expr;

but finally the valid block tree

(gdb) p debug_tree (expr)
 <block 0x7ffff6828fa0
    vars <imported_decl 0x7ffff681e8a0 D.2856
        type <void_type 0x7ffff66bd000 void asm_written VOID
            align 8 symtab 0 alias set -1 canonical type 0x7ffff66bd000
            pointer_to_this <pointer_type 0x7ffff66bd0a8>>
        VOID file t.ii line 39 col 2
        align 1 initial <function_decl 0x7ffff682a100 ldexp>
        chain <var_decl 0x7ffff66abd10 c type <real_type 0x7ffff66bd498 long
double>
            public static weak XF file t.ii line 28 col 13
            size <integer_cst 0x7ffff66b50a0 constant 128>
            unit size <integer_cst 0x7ffff66b50c0 constant 16>
            align 128 context <function_decl 0x7ffff6821a00
get_min_shift_value>

gets invalid by

Hardware watchpoint 16: *$111

Old value = <var_decl 0x7ffff66abd10 c>
New value = <var_decl 0x7ffff683c8e8 d>
0x0000000000cd579b in streamer_read_chain (ib=0x7fffffffd990, 
    data_in=0x1bee740)
    at /space/rguenther/src/svn/gcc-4_9-branch/gcc/tree-streamer-in.c:85
85              TREE_CHAIN (prev) = curr;

where 'prev' is that IMPORTED_DECL which is streamed globally it seems (ups).

And we miss r212992 on the branch.

Reply via email to