[Bug lto/87906] [9 Regression] ICE in tree check: expected block, have function_decl in block_ultimate_origin, at tree.c:12326 since r264734

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 6 15:34:00 GMT 2018


Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, so the assert is somewhat bogus if it triggers:

12324         gcc_checking_assert ((DECL_P (origin)
12325                               && DECL_ORIGIN (origin) == origin)
12326                              || BLOCK_ORIGIN (origin) == origin);

when it's a DECL_P but DECL_ORIGIN is wrecked then we access a DECL as BLOCK.

(gdb) p origin
$3 = <function_decl 0x7ffff6a74f00 __dt_base >
(gdb) p origin->decl_common.abstract_origin 
$4 = <function_decl 0x7ffff6a74e00 __dt >

what this means is that when we do tree/decl merging we end up merging
sth with DECL_ORIGIN (x) == x to a prevailing node which does not
honor this property.  This makes

      BLOCK_ABSTRACT_ORIGIN (id->block) = DECL_ORIGIN (fn);

as set by the inliner not the ultimate origin and thus we ICE.


(gdb) commands 8
Type commands for breakpoint(s) 8, one per line.
End with a line saying just "end".
>p decl->decl_common.abstract_origin
>p prevailing->decl_common.abstract_origin

Breakpoint 8, lto_symtab_prevail_decl (
    prevailing=<function_decl 0x7ffff6a74c00 __dt_base >, 
    decl=<function_decl 0x7ffff667a600 __dt_base >)
    at /space/rguenther/src/gcc-slpcost/gcc/lto/lto-symtab.h:34
34        gcc_checking_assert (! DECL_LANG_FLAG_0 (decl));
$3 = <tree 0x0>
$4 = <function_decl 0x7ffff6a74b00 __dt >

And that probably happens because of the ODR violation.

More information about the Gcc-bugs mailing list