https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95155

            Bug ID: 95155
           Summary: d: wrong vtable offset in virtual function call
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Seen when compiling self-hosted D compiler.

release/gcc-9 compiles:

isBaseOf (struct TypeClass * const this, struct Type * t, int * poffset)
{
  if (t != 0B && t->ty == 7)
    {
      {
        struct ClassDeclaration * cd;

        cd = ((struct TypeClass *) t)->sym;
        if (MEM[(bool (*<T1704>) (struct ClassDeclaration *, struct
ClassDeclaration *, int *))this->sym->__vptr + 704B] (this->sym, cd, poffset))
          {
            return <retval> = 1;
          }
      }
    }
  return <retval> = 0;
}


release/gcc-10 compiles:

isBaseOf (struct TypeClass * const this, struct Type * t, int * poffset)
{
  if (t != 0B && t->ty == 7)
    {
      {
        struct ClassDeclaration * cd;

        cd = ((struct TypeClass *) t)->sym;
        if (MEM[(bool (*<T171b>) (struct ClassDeclaration *, struct
ClassDeclaration *, int *))this->sym->__vptr + 736B] (this->sym, cd, poffset))
          {
            return <retval> = 1;
          }
      }
    }
  return <retval> = 0;
}


Applied all changes to gcc/d to the gcc-9 branch, and the problem gets
resolved, so will have to comb through the diff to find out what missing change
is causing gdc-9 to miscompile.

Reply via email to