Article View: gnu.g++.bug
Article #620G++ 1.36.1 assigns overlapping storage to protected members in multiple inheritance
From: Michael Tiemann
Date: Mon, 27 Nov 1989 06:59
Date: Mon, 27 Nov 1989 06:59
58 lines
2539 bytes
2539 bytes
You win the prize! There was one multiple-inheritance bug that was
stopping some friends of mine at Boulder (Dirk, do you still watch
this space?), but they couldn't narrow it down. I think that you
might have found the same one idenpendently. So identified, it was
very easy to fix:
arkesden% diff -c2 cplus-typeck.c~ cplus-typeck.c
*** cplus-typeck.c~ Tue Nov 14 13:49:35 1989
--- cplus-typeck.c Sun Nov 26 22:56:34 1989
***************
*** 1264,1275 ****
if (TREE_CODE (TYPE_NAME (context)) == TYPE_DECL)
{
! if (DECL_OFFSET (TYPE_NAME (context)) != 0)
! intermediate = build (COMPONENT_REF, TREE_TYPE (datum), datum,
! TYPE_NAME (context));
! else if (TYPE_USES_VIRTUAL_BASECLASSES (basetype)
! && value_member (context,
! CLASSTYPE_VBASECLASSES (basetype)))
{
! tree ptr = build_vbase_pointer (datum, context);
intermediate = build_indirect_ref (ptr, 0);
}
--- 1264,1285 ----
if (TREE_CODE (TYPE_NAME (context)) == TYPE_DECL)
{
! tree assoc = value_member (context, CLASSTYPE_ASSOC (basetype));
! if (assoc)
{
! context = TREE_TYPE (assoc);
! if (DECL_OFFSET (TYPE_NAME (context)) != 0)
! intermediate = build (COMPONENT_REF, TREE_TYPE (datum), datum,
! TYPE_NAME (context));
! }
! else
! {
! tree ptr;
!
! if (TYPE_USES_VIRTUAL_BASECLASSES (basetype))
! assoc = value_member (DECL_FIELD_CONTEXT (field),
! CLASSTYPE_VBASECLASSES (basetype));
! assert (assoc != NULL_TREE);
! context = TREE_TYPE (assoc);
! ptr = build_vbase_pointer (datum, context);
intermediate = build_indirect_ref (ptr, 0);
}
arkesden%
And the results:
arkesden% !g
g++ -B./ l8.cc
arkesden% a.out
a = 0, b = 0.
a = 1, b = 0.
arkesden%
Michael
Technical Details
Message-ID:
<8911270659.AA16921@arkesden.sun.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!arkesden.eng.sun.com!tiemannReferences:
<8911152027.AA24665@sun.Sun.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!arkesden.eng.sun.com!tiemann From: tiemann@arkesden.eng.sun.com (Michael Tiemann) Newsgroups: gnu.g++.bug Subject: G++ 1.36.1 assigns overlapping storage to protected members in multiple inheritance Message-ID: <8911270659.AA16921@arkesden.sun.com> Date: 27 Nov 89 06:59:45 GMT References: <8911152027.AA24665@sun.Sun.COM> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@sun.com Distribution: gnu Organization: GNUs Not Usenet Lines: 58