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:
> Hi,
> 
> In build_binary_op, the NE_EXPR/EQ_EXPR comparison of a ptrmemfunc type to a
> null_ptr_cst only looks at the pfn. This breaks ptrmemfunc_vbit_in_delta 
> targets as it is possible to have a pfn of 0. 

On such a target, what does a PFN of zero and a DELTA of 2 indicate?
That's a non-virtual function call, with an offset of 2; therefore, I
would think that is a NULL pointer.

I would expect that kind of thing could arise with something like:

  struct A {
    int i;
  };

  struct B {
    int j;
  };

  struct C : public A, B {
  };

  void (B::*p)() = 0;
  void (C::*q)() = q;

since, here, the compiler just needs to update delta; it has no need to
check PFN.  Therefore, I would expect that your code should explicitly
check DELTA & 1, rather than just DELTA.

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