Article View: gnu.g++.bug
Article #1511Patch Re: Bad constructor code in G++ 1.27.0
From: Clark Cooper
Date: Tue, 25 Oct 1988 13:26
Date: Tue, 25 Oct 1988 13:26
66 lines
3030 bytes
3030 bytes
In message <8810241502.AA02620@gecrux.steinmetz>, I described a
bug in G++ 1.27.0 that caused incorrect code to be generated for some
derived constructors. I believe the patch below fixes the problem without
introducing new ones.
I tested out the G++ compiler with this patch on InterViews 2.4,
where I originally discovered the bug. It compiled successfully as did
the InterViews Window Manager. The InterViews Window Manager appears to
work correctly with this patch to the compiler.
Since I'm not initimate with this code, this patch should probably
be treated with suspicion until Michael Tiemann, or someone else closely
associated with it, can pass on it.
================
*** ../dist-g++/init.c.orig Tue Sep 20 09:43:23 1988
--- init.c Tue Oct 25 08:45:05 1988
***************
*** 265,285 ****
for (i = 1; i <= n_baseclasses; i++)
{
tree base = current_class_decl;
basetype = CLASSTYPE_BASECLASS (current_class_type, i);
! if (TREE_VIRTUAL (basetype))
! base = convert_to_nonzero_pointer (TYPE_POINTER_TO (basetype),
! current_class_decl);
!
! if (! CLASSTYPE_VIA_VIRTUAL (current_class_type, i)
! && (TREE_VIRTUAL (basetype) | TREE_NEEDS_CONSTRUCTOR (basetype)))
{
! if (! CLASSTYPE_MARKED3 (basetype))
do_aggr_init (build_indirect_ref (base, 0), NULL_TREE,
CLASSTYPE_OFFSET (basetype) == integer_zero_node);
}
CLASSTYPE_MARKED3 (basetype) = 0;
/* Now, if this base class did not come "straight-up",
straighten it here. "Straighten" has quite a funny
spelling, but we do not report that here. */
--- 265,285 ----
for (i = 1; i <= n_baseclasses; i++)
{
tree base = current_class_decl;
basetype = CLASSTYPE_BASECLASS (current_class_type, i);
! if (TREE_NEEDS_CONSTRUCTOR (basetype) || TREE_VIRTUAL (basetype))
{
! base = convert_to_nonzero_pointer (TYPE_POINTER_TO (basetype),
! current_class_decl);
!
! if (! (CLASSTYPE_VIA_VIRTUAL (current_class_type, i)
! || CLASSTYPE_MARKED3 (basetype)))
do_aggr_init (build_indirect_ref (base, 0), NULL_TREE,
CLASSTYPE_OFFSET (basetype) == integer_zero_node);
}
+
CLASSTYPE_MARKED3 (basetype) = 0;
/* Now, if this base class did not come "straight-up",
straighten it here. "Straighten" has quite a funny
spelling, but we do not report that here. */
----
Clark Cooper cooper@gecrux.steinmetz.ge.com, coopercc@crd.ge.com,
coopercc@ge-crd.arpa, ...!uunet!steinmetz!cooper
Technical Details
Message-ID:
<8810251326.AA03711@gecrux.steinmetz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!steinmetz!cooperShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!steinmetz!cooper From: steinmetz!cooper@UUNET.UU.NET (Clark Cooper) Newsgroups: gnu.g++.bug Subject: Patch Re: Bad constructor code in G++ 1.27.0 Message-ID: <8810251326.AA03711@gecrux.steinmetz> Date: 25 Oct 88 13:26:22 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 66