This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch / RFC] PR 50870


.. thus now I'm investigating, comparing 4.5 to mainline, where the former gets the TYPE_BINFO of the TREE_OPERAND (member, 0). And the answer is "simple": at the beginning of tsubst_copy_and_build case COMPONENT_REF itself! Where:

    member = TREE_OPERAND (t, 1);
    if (BASELINK_P (member))
      member = tsubst_baselink (member,
                    non_reference (TREE_TYPE (object)),
                    args, complain, in_decl);
    else
      member = tsubst_copy (member, args, complain, in_decl);

the tsubst_copy call changes very little member in mainline. From this:

<scope_ref 0x7ffff563db70 tree_0 tree_1
arg 0 <record_type 0x7ffff577f540 impl type_0 type_5 type_6 VOID
align 8 symtab 0 alias set -1 canonical type 0x7ffff577f540 context <translation_unit_decl 0x7ffff5646170 D.1>
full-name "struct impl<V>"
no-binfo use_template=1 interface-unknown
chain <type_decl 0x7ffff5780170 impl>>
arg 1 <template_id_expr 0x7ffff563dae0
arg 0 <identifier_node 0x7ffff577e790 create
bindings <(nil)>
local bindings <(nil)>>
arg 1 <tree_vec 0x7ffff5769ed8 elt 0 <template_type_parm 0x7ffff577f3f0 U>>>>


to this:

<scope_ref 0x7ffff563dd20 tree_0 tree_1
arg 0 <record_type 0x7ffff577f9d8 impl type_0 type_5 type_6 VOID
align 8 symtab 0 alias set -1 canonical type 0x7ffff577f9d8 context <translation_unit_decl 0x7ffff5646170 D.1>
full-name "struct impl<V>"
no-binfo use_template=1 interface-unknown
chain <type_decl 0x7ffff57802e0 impl>>
arg 1 <template_id_expr 0x7ffff563dcf0
type <lang_type 0x7ffff5765888 unknown type type <lang_type 0x7ffff5765888 unknown type>
VOID
align 1 symtab 0 alias set -1 canonical type 0x7ffff5765888
pointer_to_this <lang_type 0x7ffff5765888 unknown type> reference_to_this <lang_type 0x7ffff5765888 unknown type>>


arg 0 <identifier_node 0x7ffff577e790 create
bindings <(nil)>
local bindings <(nil)>>
arg 1 <tree_vec 0x7ffff5783140 elt 0 <template_type_parm 0x7ffff577f7e0 U>>>>


note: no changes for arg0, no-binfo.

Instead, in the 4.5 case, from:

<scope_ref 0x7ffff7f8d188 tree_0
    arg 0 <record_type 0x7ffff5a15348 impl type_0 type_5 type_6 VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff5a15348
        full-name "struct impl<V>"
        no-binfo use_template=1 interface-unknown
        chain <type_decl 0x7ffff5a01c38 impl>>
    arg 1 <template_id_expr 0x7ffff7f8d0e0
        arg 0 <identifier_node 0x7ffff5a11840 create
        bindings <(nil)>
        local bindings <(nil)>>
        arg 1 <tree_vec 0x7ffff5a164d8
            elt 0 <template_type_parm 0x7ffff5a151f8 U>>>>

To:

<scope_ref 0x7ffff7f8d268 tree_0
arg 0 <record_type 0x7ffff5a15690 impl type_5 type_6 QI
size <integer_cst 0x7ffff7e6d730 constant 8>
unit size <integer_cst 0x7ffff7e6d758 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x7ffff5a15690
fields <type_decl 0x7ffff5a17170 impl type <record_type 0x7ffff5a157e0 impl>
external nonlocal suppress-debug decl_4 VOID file 50870.C line 6 col 3
align 8 context <record_type 0x7ffff5a15690 impl> result <record_type 0x7ffff5a15690 impl>
>
full-name "struct impl<float>"
X() X(constX&) this=(X&) n_parents=0 use_template=1 interface-unknown
pointer_to_this <pointer_type 0x7ffff5a15738> chain <type_decl 0x7ffff5a170b8 impl>>
arg 1 <template_id_expr 0x7ffff7f8d230
type <lang_type 0x7ffff59f8bd0 unknown type type <lang_type 0x7ffff59f8bd0 unknown type>
VOID
align 1 symtab 0 alias set -1 canonical type 0x7ffff59f8bd0
pointer_to_this <lang_type 0x7ffff59f8bd0 unknown type> reference_to_this <lang_type 0x7ffff59f8bd0 unknown type>>


        arg 0 <identifier_node 0x7ffff5a11840 create
        bindings <(nil)>
        local bindings <(nil)>>
        arg 1 <tree_vec 0x7ffff5a16b18
            elt 0 <integer_type 0x7ffff7e82498 int>>>>

arg0 gets its fields. Now, a big difference between the two - 4.5 vs mainline - tsubst_copy calls, is the args argument.

In 4.5, a very simple and understandable:

<tree_vec 0x7ffff59f67c0
    elt 0 <pointer_type 0x7ffff5a15738>
    elt 1 <integer_type 0x7ffff7e82498 int>
    elt 2 <real_type 0x7ffff7e96150 float>>

in mainline:

<tree_vec 0x7ffff5758fc0
    elt 0 <template_type_parm 0x7ffff577f738 T VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff577f738
       index 0 level 1 orig_level 1
        chain <type_decl 0x7ffff576df18 T>>
    elt 1 <template_type_parm 0x7ffff577f7e0 U VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff577f7e0
       index 1 level 1 orig_level 1
        chain <type_decl 0x7ffff5780000 U>>
    elt 2 <template_type_parm 0x7ffff577f888 V type_0 type_6 VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff577f888
       index 2 level 1 orig_level 1
        chain <type_decl 0x7ffff57800b8 V>>
    elt 3 <template_type_parm 0x7ffff577f930 VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff577f930
       index 3 level 1 orig_level 1
        chain <type_decl 0x7ffff5780228 D.1853>>>

args comes directly from the tsubst_copy_and_build arguments, looks like we reach case COMPONENT_REF with the template arguments still unsubstituted, something is simply not done earlier in mainline.

I guess I had better stopping here in terms of details on the mailing list today. If you have some further hints...

Thanks!
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]