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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |middle-end
             Target|nvptx                       |nvptx,gcn

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
This one is odd. If I change:

--- a/gcc/lto/lto.cc
+++ b/gcc/lto/lto.cc
@@ -500,2 +500,3 @@ offload_handle_link_vars (void)
        DECL_HAS_VALUE_EXPR_P (var->decl) = 1;
+       varpool_node::finalize_decl (link_ptr_var);
       }

and walk lto1 in the debugger, I see:

501             varpool_node::finalize_decl (link_ptr_var);
(gdb) p link_ptr_var
$42 = (tree) 0x7ffff70ff130

(gdb) p link_ptr_var->decl_with_vis.symtab_node 
$44 = (symtab_node *) 0x0

and

(gdb) p decl->decl_with_vis.symtab_node
$46 = (symtab_node *) 0x7ffff70fc200
(gdb) p decl->decl_with_vis.symtab_node == node
$47 = true


But later ...

Breakpoint 8, ipa_reference_var_uid (t=t@entry=0x7ffff70ff130) at
/home/tob/repos/gcc/gcc/ipa-reference.cc:149
149       if (!ipa_reference_vars_map)
(gdb) s
152         (symtab_node::get (t)->ultimate_alias_target (NULL)->decl);
(gdb) s
symtab_node::get (decl=0x7ffff70ff130) at /home/tob/repos/gcc/gcc/cgraph.h:497

(gdb) p decl->decl_with_vis.symtab_node
$49 = (symtab_node *) 0x0

* * *

The reason for this is:

#0  symtab_node::unregister (this=this@entry=0x7ffff70fc200,
info=info@entry=0x0) at /home/tob/repos/gcc/gcc/symtab.cc:472
472           decl->decl_with_vis.symtab_node = replacement_node;


(gdb) p replacement_node
$55 = (symtab_node *) 0x0

(gdb) p decl
$57 = (tree) 0x7ffff70ff130
(gdb) p debug_tree(decl)
 <var_decl 0x7ffff70ff130 A$linkptr
    type <pointer_type 0x7ffff70cec78
        type <array_type 0x7ffff70cebd0 type <integer_type 0x7ffff700b5e8 int>
            BLK
            size <integer_cst 0x7ffff70026a8 constant 32>
            unit-size <integer_cst 0x7ffff70026c0 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality domain <integer_type 0x7ffff70cea80>
            pointer_to_this <pointer_type 0x7ffff70cec78>>
        public unsigned DI
        size <integer_cst 0x7ffff7002468 constant 64>
        unit-size <integer_cst 0x7ffff7002480 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality>
    used public static unsigned DI (null):0:0 size <integer_cst 0x7ffff7002468
64> unit-size <integer_cst 0x7ffff7002480 8>
    align:64 warn_if_not_align:0>

#0  symtab_node::unregister (this=this@entry=0x7ffff70fc200,
info=info@entry=0x0) at /home/tob/repos/gcc/gcc/symtab.cc:472
#1  0x0000000001456dc1 in varpool_node::remove (this=0x7ffff70fc200) at
/home/tob/repos/gcc/gcc/varpool.cc:186
#2  0x0000000000d9ed01 in symbol_table::remove_unreachable_nodes
(this=<optimized out>, file=0x0) at /home/tob/repos/gcc/gcc/ipa.cc:631
#3  0x0000000000a57063 in ipa_passes () at
/home/tob/repos/gcc/gcc/cgraphunit.cc:2251

Reply via email to