This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] PR java/21418: Order of files on command line matters while resolving inheritance
Ranjit Mathew writes:
> On 9/21/05, Andrew Haley <aph@redhat.com> wrote:
> > Ranjit Mathew writes:
> > > On 9/21/05, Andrew Haley <aph@redhat.com> wrote:
> > > > > + super_class = CLASSTYPE_SUPER (type1);
> > > > > +
> > > > > + if (super_class && TREE_CODE (super_class) == POINTER_TYPE)
> > > >
> > > > I don't quite understand this test for POINTER_TYPE.
> > >
> > > If the super class hasn't yet been laid out, CLASSTYPE_SUPER
> > > returns a POINTER_TYPE representing the super class instead
> > > of the proper RECORD_TYPE. Now I don't know whether this is
> > > a bug or a feature, but this is what I discovered under a debugger
> > > and if I look at the while loop surrounding this code, only a
> > > RECORD_TYPE seems kosher.
> > >
> > > If you look at the code in maybe_layout_super_class(), when
> > > faced with a POINTER_TYPE for a class, it tries to resolve
> > > the class first.
> >
> > But the code you've added seems to be duplicating some of the logic in
> > maybe_layout_super_class(). Why not simply call that function?
>
> That's what I'm doing:
>
> + super_class = CLASSTYPE_SUPER (type1);
> +
> + if (super_class && TREE_CODE (super_class) == POINTER_TYPE)
> + {
> + super_class = maybe_layout_super_class (super_class, type1);
> + }
>
> Or do you mean something like simply:
>
> type1 = maybe_layout_super_class (CLASSTYPE_SUPER (type1), type1);
>
> ?
Yes.
Andrew.