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: [PATCH]: PR29066 ptrmemfunc_vbit_in_delta is broken


Ryan Mansfield wrote:

> Is the attached patch OK?

You should submit a ChangeLog entry with every patch.  It's a bit of a
formality, but it helps reviewers.  Also, do you have an FSF copyright
on file?  I see you've contributed a couple of documentation patches,
but this is more substantial, so we need to make sure your paperwork is
one file.

> +	  if (TARGET_PTRMEMFUNC_VBIT_LOCATION
> +	      == ptrmemfunc_vbit_in_delta)
> +	    {
> +	      tree e; 
> +	      tree pfn0 = pfn_from_ptrmemfunc (op0);
> +	      tree delta0 = build_ptrmemfunc_access_expr (op0,
> +			 	 		delta_identifier);
> +	      tree e1 = cp_build_binary_op (EQ_EXPR,
> +	  			            pfn0,
> +				      	    cp_convert (TREE_TYPE (pfn0),
> +						        integer_zero_node));
> +	      tree e2 = cp_build_binary_op (BIT_AND_EXPR, 
> +					    delta0,
> +				            integer_one_node);
> +	      e2 = cp_build_binary_op (EQ_EXPR, e2, integer_zero_node);
> +	      e = cp_build_binary_op (TRUTH_ANDIF_EXPR, e1, e2);
> +	      if (code == EQ_EXPR)
> +	        return e;
> +	      return cp_build_binary_op (EQ_EXPR, e, integer_zero_node);

This is the right idea -- but I don't think we want to return early
here.  If you look down further in the function, you can see there is
special handling for templates, for example; we want to get to that
point.  So, please arrange things so that we can fall through to that
code.  (You can have op0 be something like "pfn == 0 && (delta & 1) ==
0", and then have op1 be "0" or "1".)

Thanks,

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


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