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] PR 90909 ("[10 Regression] call devirtualized to pure virtual")


On Thu, Jul 04, 2019 at 02:56:47PM +0200, Paolo Carlini wrote:
> --- cp/call.c	(revision 273076)
> +++ cp/call.c	(working copy)
> @@ -9845,17 +9852,6 @@ build_new_method_call_1 (tree instance, tree fns,
>  
>  	  if (call != error_mark_node)
>  	    {
> -	      /* Optimize away vtable lookup if we know that this
> -		 function can't be overridden.  We need to check if
> -		 the context and the type where we found fn are the same,
> -		 actually FN might be defined in a different class
> -		 type because of a using-declaration. In this case, we
> -		 do not want to perform a non-virtual call.  */
> -	      if (DECL_VINDEX (fn) && ! (flags & LOOKUP_NONVIRTUAL)
> -		  && same_type_ignoring_top_level_qualifiers_p
> -		  (DECL_CONTEXT (fn), BINFO_TYPE (binfo))
> -		  && resolves_to_fixed_type_p (instance, 0))
> -		flags |= LOOKUP_NONVIRTUAL;
>                if (explicit_targs)
>                  flags |= LOOKUP_EXPLICIT_TMPL_ARGS;
>  	      /* Now we know what function is being called.  */

This change broke bootstrap, as it removes the last use of binfo
variable besides the setter of that variable.

I'll commit following as obvious if I get successfully past that point in
bootstrap:

2019-07-05  Jakub Jelinek  <jakub@redhat.com>

	PR c++/67184
	PR c++/69445
	* call.c (build_new_method_call_1): Remove set but not used variable
	binfo.

--- gcc/call.c.jj	2019-07-05 22:09:49.694367815 +0200
+++ gcc/call.c	2019-07-05 22:25:58.476016114 +0200
@@ -9564,7 +9564,7 @@ build_new_method_call_1 (tree instance,
   struct z_candidate *candidates = 0, *cand;
   tree explicit_targs = NULL_TREE;
   tree basetype = NULL_TREE;
-  tree access_binfo, binfo;
+  tree access_binfo;
   tree optype;
   tree first_mem_arg = NULL_TREE;
   tree name;
@@ -9603,7 +9603,6 @@ build_new_method_call_1 (tree instance,
   if (!conversion_path)
     conversion_path = BASELINK_BINFO (fns);
   access_binfo = BASELINK_ACCESS_BINFO (fns);
-  binfo = BASELINK_BINFO (fns);
   optype = BASELINK_OPTYPE (fns);
   fns = BASELINK_FUNCTIONS (fns);
   if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)


	Jakub


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