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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Fails at in today's g++ (trunk r266314 on x86_64-pc-linux-gnu) at:

Program received signal SIGSEGV, Segmentation fault.
cxx_eval_constant_expression(constexpr_ctx const*, tree_node*, bool, bool*,
bool*, tree_node**) ()

at ../../gcc/cp/constexpr.c:4834

4829              obj = TREE_OPERAND (obj, 0);
4830            tree objtype = TREE_TYPE (obj);
4831            /* Find the function decl in the virtual functions list.  TOKEN
is
4832               the DECL_VINDEX that says which function we're looking for. 
*/
4833            tree virtuals = BINFO_VIRTUALS (TYPE_BINFO (objtype));
4834            r = TREE_VALUE (chain_index (token, virtuals));

where

  "token" == 1

and "obj":

 <indirect_ref 0x7ffff2068ac0
    type <record_type 0x7ffff20880a8 five readonly addressable tree_2
needs-constructing type_5 type_6 BLK
        size <integer_cst 0x7ffff1f2ae40 constant 128>
        unit-size <integer_cst 0x7ffff1f2ae58 constant 16>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff20880a8
        fields <field_decl 0x7ffff2082720 D.2105 type <record_type
0x7ffff2081888 four>
            ignored decl_6 BLK input17.ii:11:7
            size <integer_cst 0x7ffff1f2adf8 constant 64>
            unit-size <integer_cst 0x7ffff1f2ae10 constant 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff1f2ae28 constant 0>
            bit-offset <integer_cst 0x7ffff1f2ae70 constant 0> context
<record_type 0x7ffff2081bd0 five> chain <field_decl 0x7ffff20827b8 D.2106>>
context <translation_unit_decl 0x7ffff1f37168 input17.ii>
        full-name "const class five"
        needs-constructor X() X(constX&) this=(X&) n_parents=2 use_template=0
interface-unknown
        pointer_to_this <pointer_type 0x7ffff2088150>>
    readonly
    arg:0 <non_lvalue_expr 0x7ffff2068aa0
        type <pointer_type 0x7ffff2088150 type <record_type 0x7ffff20880a8
five>
            unsigned DI size <integer_cst 0x7ffff1f2adf8 64> unit-size
<integer_cst 0x7ffff1f2ae10 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff2088150>

        arg:0 <parm_decl 0x7ffff1f53780 command type <pointer_type
0x7ffff2088150>
            used unsigned read DI input17.ii:13:24 size <integer_cst
0x7ffff1f2adf8 64> unit-size <integer_cst 0x7ffff1f2ae10 8>
            align:64 warn_if_not_align:0 context <function_decl 0x7ffff206fb00
setup>
            arg-type <pointer_type 0x7ffff2088150>>>>

"TYPE_BINFO (objtype)" is:

(gdb) p debug_tree(obj->typed.type->type_non_common.maxval)
 <tree_binfo 0x7ffff2086000
    type <record_type 0x7ffff2081bd0 five addressable tree_2 needs-constructing
type_5 type_6 BLK
        size <integer_cst 0x7ffff1f2ae40 constant 128>
        unit-size <integer_cst 0x7ffff1f2ae58 constant 16>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff2081bd0
        fields <field_decl 0x7ffff2082720 D.2105 type <record_type
0x7ffff2081888 four>
            ignored decl_6 BLK input17.ii:11:7
            size <integer_cst 0x7ffff1f2adf8 constant 64>
            unit-size <integer_cst 0x7ffff1f2ae10 constant 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff1f2ae28 constant 0>
            bit-offset <integer_cst 0x7ffff1f2ae70 constant 0> context
<record_type 0x7ffff2081bd0 five> chain <field_decl 0x7ffff20827b8 D.2106>>
context <translation_unit_decl 0x7ffff1f37168 input17.ii>
        full-name "class five"
        needs-constructor X() X(constX&) this=(X&) n_parents=2 use_template=0
interface-unknown
        chain <type_decl 0x7ffff20825f0 five>>
    private tree_2 bases:2 offset <integer_cst 0x7ffff1f2ae28 0> virtuals
<tree_list 0x7ffff2080460>>


And "virtuals" is:

(gdb) p debug_tree(obj->typed.type->type_non_common.maxval->binfo.virtuals)
 <tree_list 0x7ffff2080460
    purpose <integer_cst 0x7ffff1f4c198 type <integer_type 0x7ffff1f485e8 int>
constant 0>
    value <function_decl 0x7ffff206f800 is_wavelength
        type <method_type 0x7ffff206cbd0 type <integer_type 0x7ffff1f485e8 int>
            QI
            size <integer_cst 0x7ffff1f2aee8 constant 8>
            unit-size <integer_cst 0x7ffff1f2af00 constant 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff206cbd0 method basetype <record_type 0x7ffff206c930 one>
            arg-types <tree_list 0x7ffff2065ed8 value <pointer_type
0x7ffff206cc78>
                chain <tree_list 0x7ffff1f3e848 value <void_type 0x7ffff1f48f18
void>>>>
        public private external virtual QI input17.ii:2:15 align:16
warn_if_not_align:0 context <record_type 0x7ffff206c930 one>
        full-name "virtual int one::is_wavelength() const"

        chain <type_decl 0x7ffff20357b8 one type <record_type 0x7ffff206c9d8
one>
            nonlocal decl_4 VOID input17.ii:1:11
            align:1 warn_if_not_align:0 context <record_type 0x7ffff206c930
one> result <record_type 0x7ffff206c930 one>
           >>>

and TREE_CHAIN(virtuals)  alias  chain_index (1 /* = token */, virtuals):

(gdb) p obj->typed.type->type_non_common.maxval->binfo.virtuals->common.chain
$13 = (tree) 0x0

Hence, TREE_VALUE (chain_index(1, virtuals) == TREE_VALUE(NULL_TREE) fails ...

Reply via email to