[PATCH][C++] Fix PR38334, TBAA issues with vtbl loads

Mark Mitchell mark@codesourcery.com
Tue Dec 2 23:47:00 GMT 2008


Richard Guenther wrote:

 Index: typeck.c
> ===================================================================
> --- typeck.c	(revision 142371)
> +++ typeck.c	(working copy)
> @@ -2790,6 +2790,10 @@ get_member_function_from_ptrfunc (tree *
>        vtbl = build1 (NOP_EXPR, build_pointer_type (vtbl_ptr_type_node),
>  		     instance_ptr);
>        vtbl = cp_build_indirect_ref (vtbl, NULL, tf_warning_or_error);
> +      /* If the object is not dynamic the access invokes undefined
> +	 behavior.  As it is not executed in this case silence the
> +	 spurious warnings it may provoke.  */
> +      TREE_NO_WARNING (vtbl) = 1;
>  
>        /* Finally, extract the function pointer from the vtable.  */
>        e2 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl,

This is fine, thanks.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list