public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: Paolo Carlini <pcarlini@gmail.com>
Cc: Jason Merrill <jason@redhat.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch / RFC] PR 50870
Date: Fri, 28 Oct 2011 01:44:00 -0000	[thread overview]
Message-ID: <4EA9F0D3.4040800@oracle.com> (raw)
In-Reply-To: <4EA9E469.2070701@oracle.com>

.. 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.

  reply	other threads:[~2011-10-28  0:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 15:28 Paolo Carlini
2011-10-26 16:25 ` Jason Merrill
2011-10-26 17:12   ` Paolo Carlini
2011-10-26 18:15     ` Jason Merrill
2011-10-26 22:54       ` Paolo Carlini
2011-10-26 23:23         ` Paolo Carlini
2011-10-27  0:00         ` Jason Merrill
2011-10-27  0:01           ` Paolo Carlini
2011-10-27  0:02             ` Paolo Carlini
2011-10-27  7:38               ` Jason Merrill
2011-10-27 12:34                 ` Paolo Carlini
2011-10-27 13:16                   ` Jason Merrill
2011-10-27 13:19                     ` Paolo Carlini
2011-10-27 13:20                       ` Jason Merrill
2011-10-27 14:56                         ` Paolo Carlini
2011-10-27 23:29                           ` Paolo Carlini
2011-10-28  1:44                             ` Paolo Carlini [this message]
2011-10-28  2:00                               ` Paolo Carlini
2011-10-28 16:59                                 ` Jason Merrill
2011-10-28 17:00                                   ` Paolo Carlini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA9F0D3.4040800@oracle.com \
    --to=paolo.carlini@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=pcarlini@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).