This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR 29585: C++ front end not setting TREE_ADDRESSABLE on vtbl entries
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>, Diego Novillo <dnovillo at redhat dot com>
- Date: Tue, 10 Apr 2007 18:13:19 -0700
- Subject: Re: PR 29585: C++ front end not setting TREE_ADDRESSABLE on vtbl entries
- References: <460EA260.3000404@redhat.com> <609E9D48-5C58-436C-AA82-B77A016E58C0@apple.com> <E4020EBA-6F7A-4906-A5F1-AB4BA4CB6288@apple.com>
Mike Stump wrote:
> --- ./cp/class.c.~1~ 2007-04-04 19:37:15.000000000 -0700
> +++ ./cp/class.c 2007-04-10 17:34:46.000000000 -0700
> @@ -7108,7 +7108,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
> index = size_binop (MULT_EXPR,
> TYPE_SIZE_UNIT (vtable_entry_type),
> index);
> - vtbl = build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index);
> + vtbl = build2 (PLUS_EXPR, vtbl_ptr_type_node, vtbl, index);
That does not look to be type-correct at the tree level; the type of
VTBL + INDEX should be the same as the type of VTBL. You should
probably be using fold_convert to add the conversion, after the addition.
> I'll check this in tomorrow unless a maintainer of the code thinks it's not obvious or wrong, pretty sure it's better than the status quo.
I think that you should consider recalibrating your obviousness meter.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713