invoke.texi (-fdump-class-layout): Document.
gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
This commit is contained in:
parent
36ca672c97
commit
9965d11913
@ -1,3 +1,8 @@
|
||||
2001-02-05 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* invoke.texi (-fdump-class-layout): Document.
|
||||
(-fdump-translation-unit): Use `=' as filename separator.
|
||||
|
||||
2001-02-05 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* Makefile.in (s-mlib): Don't build multilibs if
|
||||
|
@ -1,3 +1,77 @@
|
||||
2001-02-05 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
Fix specification and implementation bugs in V3 ABI
|
||||
construction vtables.
|
||||
* cp-tree.h (flag_dump_class_layout): New flag.
|
||||
(BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove.
|
||||
(BINFO_LOST_PRIMARY_P): New flag.
|
||||
(SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts.
|
||||
(BINFO_PRIMARY_MARKED_P): Rename to ...
|
||||
(BINFO_PRIMARY_P): ... here.
|
||||
(binfo_via_virtual): New prototype.
|
||||
* decl2.c (flag_dump_class_layout): New flag.
|
||||
(cxx_decode_option): Set it. Adjust -fdump-translation-unit to
|
||||
use `=' as a file name separator.
|
||||
* init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary
|
||||
bases.
|
||||
(build_vtbl_address): If this is a virtual primary base, then
|
||||
get the vtbl of what it is ultimately primary for.
|
||||
* search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust
|
||||
for BINFO_PRIMARY_P.
|
||||
(dfs_skip_nonprimary_vbases_markedp): Likewise.
|
||||
(get_shared_vbase_if_not_primary): Likewise.
|
||||
(dfs_get_pure_virtuals): Likewise.
|
||||
(expand_upcast_fixups): Likewise.
|
||||
(fixup_virtual_upcast_offsets): Likewise.
|
||||
(dfs_find_vbase_instance): Likewise.
|
||||
(find_vbase_instance): Likewise.
|
||||
(binfo_from_vbase): Adjust comment to reflect reality.
|
||||
(binfo_via_virtual): New function.
|
||||
* class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros
|
||||
for binfo walking during VTT construction.
|
||||
(dfs_mark_primary_bases): Remove.
|
||||
(force_canonical_binfo_r): New function.
|
||||
(force_canonical_binfo): New function.
|
||||
(mark_primary_virtual_base): New function.
|
||||
(mark_primary_bases): Walk in inheritance graph order, use
|
||||
mark_primary_virtual_base.
|
||||
(determine_primary_base): Use some more intermediate variables.
|
||||
(dfs_find_final_overrider): Don't check for overriding along a
|
||||
virtual path.
|
||||
(dfs_modify_vtables): Walk into primary virtual bases too.
|
||||
(walk_subobject_offsets): Adjust for BINFO_PRIMARY_P.
|
||||
(build_base_fields): Likewise.
|
||||
(dfs_set_offset_for_unshared_vbases): Likewise.
|
||||
(layout_virtual_bases): Likewise.
|
||||
(end_of_class): Likewise.
|
||||
(finish_struct_1): Call dump_class_hierarchy, if requested.
|
||||
(dfs_get_primary_binfo): Use BINFO_TYPE for binfos.
|
||||
(dump_class_hierarchy_r): Add stream parameter. Emit more information.
|
||||
(dump_class_hierarchy): Add file parameter. Append to file, if
|
||||
required.
|
||||
(finish_vtbls): Adjust accumulate_vtbl_inits call.
|
||||
Use canonical base for virtual bases.
|
||||
(build_vtt): Add more comments. Adjust build_vtt_inits call.
|
||||
(build_vtt_inits): Remove VIRTUAL_VTTS_P parm.
|
||||
Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P,
|
||||
VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for
|
||||
virtual VTTs.
|
||||
(dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P
|
||||
from DATA. We want virtual primary bases and all bases via virtual.
|
||||
Only set BINFO_VPTR_INDEX for top level. Look up from a primary
|
||||
virtual base when not a construction vtable.
|
||||
(dfs_ctor_vtable_bases_queue_p): New DFS predicate.
|
||||
(build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call.
|
||||
Use canonical bases when processing virtual bases.
|
||||
(accumulate_vtbl_inits): We're interested in any base via a
|
||||
virtual path.
|
||||
(dfs_accumulate_vtbl_inits): If this is a primary virtual base
|
||||
within a construction vtable, determine what is being overridden.
|
||||
(build_vtbl_initializer): Add more comments
|
||||
(add_vcall_offset_vtbl_entries_1): Adjust comment.
|
||||
(build_rtti_vtbl_entries): Check if the base has lost its
|
||||
primary.
|
||||
|
||||
2001-02-05 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* Makefile.in (g++spec.o): Adjust use of DRIVER_DEFINES.
|
||||
|
638
gcc/cp/class.c
638
gcc/cp/class.c
File diff suppressed because it is too large
Load Diff
@ -60,7 +60,7 @@ Boston, MA 02111-1307, USA. */
|
||||
TYPE_POLYMORHPIC_P (in _TYPE)
|
||||
ICS_THIS_FLAG (in _CONV)
|
||||
BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
|
||||
BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P (in BINFO)
|
||||
BINFO_LOST_PRIMARY_P (in BINFO)
|
||||
TREE_PARMLIST (in TREE_LIST)
|
||||
3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
|
||||
BINFO_VTABLE_PATH_MARKED.
|
||||
@ -1158,6 +1158,10 @@ extern int flag_access_control;
|
||||
|
||||
extern int flag_check_new;
|
||||
|
||||
/* Nonnull if we want to dump class heirarchies. */
|
||||
|
||||
extern const char *flag_dump_class_layout;
|
||||
|
||||
|
||||
/* C++ language-specific tree codes. */
|
||||
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
|
||||
@ -1672,11 +1676,11 @@ struct lang_type
|
||||
(TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C)))
|
||||
|
||||
/* Any subobject that needs a new vtable must have a vptr and must not
|
||||
be a primary base (since it would then use the vtable from a
|
||||
derived class.) */
|
||||
be a non-virtual primary base (since it would then use the vtable from a
|
||||
derived class and never become non-primary.) */
|
||||
#define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
|
||||
(BINFO_NEW_VTABLE_MARKED (B, C) = 1, \
|
||||
my_friendly_assert (!BINFO_PRIMARY_MARKED_P (B), 20000517), \
|
||||
my_friendly_assert (!BINFO_PRIMARY_P (B) || TREE_VIA_VIRTUAL (B), 20000517), \
|
||||
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
|
||||
20000517))
|
||||
|
||||
@ -1691,7 +1695,7 @@ struct lang_type
|
||||
class of a non-primary virtual base. This flag is only valid for
|
||||
paths (given by BINFO_INHERITANCE_CHAIN) that really exist in the
|
||||
final object. */
|
||||
#define BINFO_PRIMARY_MARKED_P(NODE) \
|
||||
#define BINFO_PRIMARY_P(NODE) \
|
||||
(BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
|
||||
|
||||
/* The index in the VTT where this subobject's sub-VTT can be found.
|
||||
@ -1708,9 +1712,10 @@ struct lang_type
|
||||
immediate base.) */
|
||||
#define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT ((NODE), 10)
|
||||
|
||||
/* Nonzero if this binfo declares a virtual function which is
|
||||
overridden along a virtual path. */
|
||||
#define BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P(NODE) TREE_LANG_FLAG_2 (NODE)
|
||||
/* Nonzero if this binfo has lost its primary base binfo (because that
|
||||
is a nearly-empty virtual base that has been taken by some other
|
||||
base in the complete heirarchy. */
|
||||
#define BINFO_LOST_PRIMARY_P(NODE) TREE_LANG_FLAG_2 (NODE)
|
||||
|
||||
/* Nonzero if this binfo is an indirect primary base, i.e. a virtual
|
||||
base that is a primary base of some of other class in the
|
||||
@ -4248,6 +4253,7 @@ extern tree unmarked_vtable_pathp PARAMS ((tree, void *));
|
||||
extern tree convert_pointer_to_vbase PARAMS ((tree, tree));
|
||||
extern tree find_vbase_instance PARAMS ((tree, tree));
|
||||
extern tree binfo_for_vbase PARAMS ((tree, tree));
|
||||
extern tree binfo_via_virtual PARAMS ((tree, tree));
|
||||
extern void fixup_all_virtual_upcast_offsets PARAMS ((tree));
|
||||
|
||||
/* in semantics.c */
|
||||
|
@ -403,6 +403,10 @@ int flag_operator_names = 1;
|
||||
|
||||
int flag_check_new;
|
||||
|
||||
/* Nonnull if we want to dump class heirarchies. */
|
||||
|
||||
const char *flag_dump_class_layout;
|
||||
|
||||
/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
|
||||
initialization variables.
|
||||
0: Old rules, set by -fno-for-scope.
|
||||
@ -647,13 +651,23 @@ cxx_decode_option (argc, argv)
|
||||
name_mangling_version
|
||||
= read_integral_parameter (option_value, p - 2, name_mangling_version);
|
||||
else if ((option_value
|
||||
= skip_leading_substring (p, "dump-translation-unit-")))
|
||||
= skip_leading_substring (p, "dump-translation-unit=")))
|
||||
{
|
||||
if (p[22] == '\0')
|
||||
if (!*option_value)
|
||||
error ("no file specified with -fdump-translation-unit");
|
||||
else
|
||||
flag_dump_translation_unit = option_value;
|
||||
}
|
||||
else if ((option_value
|
||||
= skip_leading_substring (p, "dump-class-layout=")))
|
||||
{
|
||||
if (!*option_value)
|
||||
error ("no file specified with -fdump-class-layout");
|
||||
else
|
||||
flag_dump_class_layout = option_value;
|
||||
}
|
||||
else if (!strcmp (p, "dump-class-layout"))
|
||||
flag_dump_class_layout = ""; /* empty string for stderr */
|
||||
else
|
||||
{
|
||||
int found = 0;
|
||||
|
@ -137,7 +137,7 @@ dfs_initialize_vtbl_ptrs (binfo, data)
|
||||
tree binfo;
|
||||
void *data;
|
||||
{
|
||||
if (!BINFO_PRIMARY_MARKED_P (binfo)
|
||||
if ((!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
|
||||
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
|
||||
{
|
||||
tree base_ptr = TREE_VALUE ((tree) data);
|
||||
@ -802,16 +802,27 @@ static tree
|
||||
build_vtbl_address (binfo)
|
||||
tree binfo;
|
||||
{
|
||||
tree binfo_for = binfo;
|
||||
tree vtbl;
|
||||
|
||||
if (BINFO_VPTR_INDEX (binfo) && TREE_VIA_VIRTUAL (binfo)
|
||||
&& BINFO_PRIMARY_P (binfo))
|
||||
/* If this is a virtual primary base, then the vtable we want to store
|
||||
is that for the base this is being used as the primary base of. We
|
||||
can't simply skip the initialization, because we may be expanding the
|
||||
inits of a subobject constructor where the virtual base layout
|
||||
can be different. */
|
||||
while (BINFO_PRIMARY_BASE_OF (binfo_for))
|
||||
binfo_for = BINFO_PRIMARY_BASE_OF (binfo_for);
|
||||
|
||||
/* Figure out what vtable BINFO's vtable is based on, and mark it as
|
||||
used. */
|
||||
vtbl = get_vtbl_decl_for_binfo (binfo);
|
||||
vtbl = get_vtbl_decl_for_binfo (binfo_for);
|
||||
assemble_external (vtbl);
|
||||
TREE_USED (vtbl) = 1;
|
||||
|
||||
/* Now compute the address to use when initializing the vptr. */
|
||||
vtbl = BINFO_VTABLE (binfo);
|
||||
vtbl = BINFO_VTABLE (binfo_for);
|
||||
if (TREE_CODE (vtbl) == VAR_DECL)
|
||||
{
|
||||
vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl);
|
||||
|
@ -2045,7 +2045,7 @@ dfs_skip_nonprimary_vbases_unmarkedp (binfo, data)
|
||||
tree binfo;
|
||||
void *data ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_MARKED_P (binfo))
|
||||
if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
|
||||
/* This is a non-primary virtual base. Skip it. */
|
||||
return NULL_TREE;
|
||||
|
||||
@ -2060,7 +2060,7 @@ dfs_skip_nonprimary_vbases_markedp (binfo, data)
|
||||
tree binfo;
|
||||
void *data ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_MARKED_P (binfo))
|
||||
if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
|
||||
/* This is a non-primary virtual base. Skip it. */
|
||||
return NULL_TREE;
|
||||
|
||||
@ -2078,7 +2078,7 @@ get_shared_vbase_if_not_primary (binfo, data)
|
||||
tree binfo;
|
||||
void *data;
|
||||
{
|
||||
if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_MARKED_P (binfo))
|
||||
if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
|
||||
{
|
||||
tree type = (tree) data;
|
||||
|
||||
@ -2088,7 +2088,7 @@ get_shared_vbase_if_not_primary (binfo, data)
|
||||
/* This is a non-primary virtual base. If there is no primary
|
||||
version, get the shared version. */
|
||||
binfo = binfo_for_vbase (BINFO_TYPE (binfo), type);
|
||||
if (BINFO_PRIMARY_MARKED_P (binfo))
|
||||
if (BINFO_PRIMARY_P (binfo))
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
@ -2152,7 +2152,7 @@ dfs_get_pure_virtuals (binfo, data)
|
||||
/* We're not interested in primary base classes; the derived class
|
||||
of which they are a primary base will contain the information we
|
||||
need. */
|
||||
if (!BINFO_PRIMARY_MARKED_P (binfo))
|
||||
if (!BINFO_PRIMARY_P (binfo))
|
||||
{
|
||||
tree virtuals;
|
||||
|
||||
@ -2455,7 +2455,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
|
||||
tree delta;
|
||||
HOST_WIDE_INT n;
|
||||
|
||||
while (BINFO_PRIMARY_MARKED_P (binfo))
|
||||
while (BINFO_PRIMARY_P (binfo))
|
||||
{
|
||||
binfo = BINFO_INHERITANCE_CHAIN (binfo);
|
||||
if (TREE_VIA_VIRTUAL (binfo))
|
||||
@ -2593,7 +2593,7 @@ fixup_virtual_upcast_offsets (real_binfo, binfo, init_self, can_elide, addr, ori
|
||||
tree real_base_binfo = TREE_VEC_ELT (real_binfos, i);
|
||||
tree base_binfo = TREE_VEC_ELT (binfos, i);
|
||||
int is_not_base_vtable
|
||||
= !BINFO_PRIMARY_MARKED_P (real_base_binfo);
|
||||
= !BINFO_PRIMARY_P (real_base_binfo);
|
||||
if (! TREE_VIA_VIRTUAL (real_base_binfo))
|
||||
fixup_virtual_upcast_offsets (real_base_binfo, base_binfo,
|
||||
is_not_base_vtable, can_elide, addr,
|
||||
@ -2737,7 +2737,7 @@ dfs_find_vbase_instance (binfo, data)
|
||||
{
|
||||
tree base = TREE_VALUE ((tree) data);
|
||||
|
||||
if (BINFO_PRIMARY_MARKED_P (binfo)
|
||||
if (BINFO_PRIMARY_P (binfo)
|
||||
&& same_type_p (BINFO_TYPE (binfo), base))
|
||||
return binfo;
|
||||
|
||||
@ -2755,7 +2755,7 @@ find_vbase_instance (base, type)
|
||||
tree instance;
|
||||
|
||||
instance = binfo_for_vbase (base, type);
|
||||
if (!BINFO_PRIMARY_MARKED_P (instance))
|
||||
if (!BINFO_PRIMARY_P (instance))
|
||||
return instance;
|
||||
|
||||
return dfs_walk (TYPE_BINFO (type),
|
||||
@ -3249,8 +3249,8 @@ binfo_for_vtable (var)
|
||||
return main_binfo;
|
||||
}
|
||||
|
||||
/* Returns the binfo of the first direct or indirect virtual base from
|
||||
which BINFO is derived, or NULL if binfo is not via virtual. */
|
||||
/* Returns the binfo of the first direct or indirect virtual base derived
|
||||
from BINFO, or NULL if binfo is not via virtual. */
|
||||
|
||||
tree
|
||||
binfo_from_vbase (binfo)
|
||||
@ -3264,6 +3264,24 @@ binfo_from_vbase (binfo)
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Returns the binfo of the first direct or indirect virtual base derived
|
||||
from BINFO up to the TREE_TYPE, LIMIT, or NULL if binfo is not
|
||||
via virtual. */
|
||||
|
||||
tree
|
||||
binfo_via_virtual (binfo, limit)
|
||||
tree binfo;
|
||||
tree limit;
|
||||
{
|
||||
for (; binfo && (!limit || !same_type_p (BINFO_TYPE (binfo), limit));
|
||||
binfo = BINFO_INHERITANCE_CHAIN (binfo))
|
||||
{
|
||||
if (TREE_VIA_VIRTUAL (binfo))
|
||||
return binfo;
|
||||
}
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Returns the BINFO (if any) for the virtual baseclass T of the class
|
||||
C from the CLASSTYPE_VBASECLASSES list. */
|
||||
|
||||
|
@ -223,8 +223,8 @@ in the following sections.
|
||||
@item Debugging Options
|
||||
@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
|
||||
@gccoptlist{
|
||||
-a -ax -d@var{letters} -fdump-unnumbered -fdump-translation-unit-@var{file} @gol
|
||||
-fpretend-float -fprofile-arcs -ftest-coverage @gol
|
||||
-a -ax -d@var{letters} -fdump-unnumbered -fdump-translation-unit=@var{file} @gol
|
||||
-fdump-class-layout=@var{file} -fpretend-float -fprofile-arcs -ftest-coverage @gol
|
||||
-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol
|
||||
-ggdb -gstabs -gstabs+ -gxcoff -gxcoff+ @gol
|
||||
-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
|
||||
@ -2679,10 +2679,15 @@ numbers and line number note output. This makes it more feasible to
|
||||
use diff on debugging dumps for compiler invocations with different
|
||||
options, in particular with and without -g.
|
||||
|
||||
@item -fdump-translation-unit-@var{file} (C and C++ only)
|
||||
@item -fdump-translation-unit=@var{file} (C and C++ only)
|
||||
Dump a representation of the tree structure for the entire translation
|
||||
unit to @var{file}.
|
||||
|
||||
@item -fdump-class_layout=@var{file} (C++ only)
|
||||
@item -fdump-class_layout (C++ only)
|
||||
Dump a representation of each class's heirarchy to @var{file}, or
|
||||
@code{stderr} if not specified.
|
||||
|
||||
@item -fpretend-float
|
||||
When running a cross-compiler, pretend that the target machine uses the
|
||||
same floating point format as the host machine. This causes incorrect
|
||||
|
@ -1,3 +1,22 @@
|
||||
2001-02-05 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.abi/primary2.C: New test.
|
||||
* g++.old-deja/g++.abi/primary3.C: New test.
|
||||
* g++.old-deja/g++.abi/primary4.C: New test.
|
||||
* g++.old-deja/g++.abi/primary5.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3.h: New test.
|
||||
* g++.old-deja/g++.abi/vtable3a.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3b.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3c.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3d.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3e.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3f.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3g.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3h.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3i.C: New test.
|
||||
* g++.old-deja/g++.abi/vtable3j.C: New test.
|
||||
* g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL.
|
||||
|
||||
2001-02-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* g++.old-deja/g++.other/anon6.C: New test.
|
||||
|
21
gcc/testsuite/g++.old-deja/g++.abi/primary2.C
Normal file
21
gcc/testsuite/g++.old-deja/g++.abi/primary2.C
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check primary bases are chosen correctly.
|
||||
|
||||
struct A {virtual void Foo () {}};
|
||||
struct B : virtual A {};
|
||||
struct C : virtual B {};
|
||||
struct D : virtual B, virtual C {};
|
||||
|
||||
int main ()
|
||||
{
|
||||
D d;
|
||||
|
||||
#if __GXX_ABI_VERSION >= 100
|
||||
if (sizeof (D) != sizeof (A))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
34
gcc/testsuite/g++.old-deja/g++.abi/primary3.C
Normal file
34
gcc/testsuite/g++.old-deja/g++.abi/primary3.C
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check primary bases are chosen correctly.
|
||||
|
||||
struct A {virtual void Foo () {}};
|
||||
struct B1 : virtual A {};
|
||||
struct B2 : virtual A {};
|
||||
struct C : virtual B1, B2 {};
|
||||
struct D : virtual C {};
|
||||
|
||||
int main ()
|
||||
{
|
||||
C c;
|
||||
D d;
|
||||
|
||||
A *apc = &c;
|
||||
B1 *b1pc = &c;
|
||||
B2 *b2pc = &c;
|
||||
|
||||
A *apd = &d;
|
||||
B1 *b1pd = &d;
|
||||
B2 *b2pd = &d;
|
||||
|
||||
#if __GXX_ABI_VERSION >= 100
|
||||
if (static_cast <void *> (apc) != static_cast <void *> (b1pc))
|
||||
return 1;
|
||||
if (static_cast <void *> (apd) != static_cast <void *> (b1pd))
|
||||
return 2;
|
||||
if (static_cast <void *> (apd) != static_cast <void *> (&d))
|
||||
return 3;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
27
gcc/testsuite/g++.old-deja/g++.abi/primary4.C
Normal file
27
gcc/testsuite/g++.old-deja/g++.abi/primary4.C
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check primary bases are chosen correctly.
|
||||
|
||||
struct A { virtual void Foo () {}};
|
||||
|
||||
struct B1 : virtual A {};
|
||||
struct B2 : virtual A {};
|
||||
|
||||
struct C : virtual B1 {};
|
||||
|
||||
struct D : virtual B1, B2, C {};
|
||||
|
||||
int main ()
|
||||
{
|
||||
D d;
|
||||
A *ap = &d;
|
||||
C *cp = &d;
|
||||
|
||||
#if __GXX_ABI_VERSION >= 100
|
||||
if (static_cast <void *> (ap) != static_cast <void *> (cp))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
36
gcc/testsuite/g++.old-deja/g++.abi/primary5.C
Normal file
36
gcc/testsuite/g++.old-deja/g++.abi/primary5.C
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check primary bases are chosen correctly.
|
||||
|
||||
struct A1
|
||||
{
|
||||
virtual void Foo () {};
|
||||
};
|
||||
|
||||
struct A : A1
|
||||
{
|
||||
};
|
||||
|
||||
struct B : A
|
||||
{
|
||||
};
|
||||
|
||||
struct C : virtual B
|
||||
{
|
||||
};
|
||||
|
||||
struct D : virtual B, virtual C
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
D d;
|
||||
#if __GXX_ABI_VERSION >= 100
|
||||
if (sizeof (D) != sizeof (A))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
181
gcc/testsuite/g++.old-deja/g++.abi/vtable3.h
Normal file
181
gcc/testsuite/g++.old-deja/g++.abi/vtable3.h
Normal file
@ -0,0 +1,181 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work. This is included from numerous test
|
||||
// files, which set the #defines necessary to specify the heirarchy.
|
||||
|
||||
#include <typeinfo>
|
||||
#include <stdio.h>
|
||||
|
||||
// XXX. vcall offsets are still broken, remove this define to re-enable
|
||||
// testing when fixed.
|
||||
#define NO_VCALL_TEST
|
||||
|
||||
int fail;
|
||||
|
||||
template <typename BASE, typename DERIVED>
|
||||
int Test (DERIVED *d, int expect)
|
||||
{
|
||||
BASE *b = static_cast <BASE *> (d);
|
||||
void *full_b = dynamic_cast <void *> (b);
|
||||
void *full_d = dynamic_cast <void *> (d);
|
||||
|
||||
if (full_b != full_d)
|
||||
{
|
||||
fail++;
|
||||
fprintf (stderr, "base %s and derived %s have different full objects\n",
|
||||
typeid (BASE).name (), typeid (DERIVED).name ());
|
||||
return 1;
|
||||
}
|
||||
|
||||
DERIVED *dynamic_d = dynamic_cast <DERIVED *> (b);
|
||||
|
||||
if (dynamic_d != d)
|
||||
{
|
||||
fail++;
|
||||
fprintf (stderr, "dynamic_cast from %s to %s failed\n",
|
||||
typeid (BASE).name (), typeid (DERIVED).name ());
|
||||
return 1;
|
||||
}
|
||||
#ifndef NO_VCALL_TEST
|
||||
b->Baz (static_cast <void *> (b));
|
||||
|
||||
int res = b->Foo (static_cast <void *> (d));
|
||||
|
||||
if (res != expect)
|
||||
{
|
||||
fail++;
|
||||
fprintf (stderr, "%s::Foo returned %d, expected %d\n",
|
||||
typeid (BASE).name (), res, expect);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int Test (T *self, void *expected, int result)
|
||||
{
|
||||
if (self != expected)
|
||||
{
|
||||
fail++;
|
||||
fprintf (stderr, "%s::Foo wrong this pointer\n", typeid (T).name ());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
struct A {
|
||||
#ifndef A_EMPTY
|
||||
int a_m;
|
||||
#endif
|
||||
virtual int Foo (void *p) {return Test (this, p, 1);}
|
||||
virtual int Baz (void *p) {return Test (this, p, 1);}
|
||||
A ();
|
||||
~A ();
|
||||
};
|
||||
|
||||
struct B1: virtual A {
|
||||
#ifndef B1_EMPTY
|
||||
int b1_m;
|
||||
#endif
|
||||
virtual int Foo (void *p) {return Test (this, p, 2);}
|
||||
B1();
|
||||
~B1();
|
||||
};
|
||||
|
||||
struct B2: virtual A {
|
||||
#ifndef B2_EMPTY
|
||||
int b2_m;
|
||||
#endif
|
||||
virtual int Foo (void *p) {return Test (this, p, 3);}
|
||||
B2();
|
||||
~B2();
|
||||
};
|
||||
|
||||
struct Empty {};
|
||||
|
||||
struct C : C_PARENTS {
|
||||
#ifndef C_EMPTY
|
||||
int c_m;
|
||||
#endif
|
||||
virtual int Foo (void *p) {return Test (this, p, 4);}
|
||||
C();
|
||||
~C();
|
||||
};
|
||||
|
||||
A::A ()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 1);
|
||||
}
|
||||
A::~A ()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 1);
|
||||
}
|
||||
|
||||
B1::B1()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 2);
|
||||
Test <B1> (this, 2);
|
||||
}
|
||||
B1::~B1()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 2);
|
||||
Test <B1> (this, 2);
|
||||
}
|
||||
B2::B2()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 3);
|
||||
Test <B2> (this, 3);
|
||||
}
|
||||
B2::~B2()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 3);
|
||||
Test <B2> (this, 3);
|
||||
}
|
||||
C::C()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 4);
|
||||
Test <C> (this, 4);
|
||||
}
|
||||
C::~C()
|
||||
{
|
||||
fprintf (stderr, "%s\n", __PRETTY_FUNCTION__);
|
||||
Test <A> (this, 4);
|
||||
Test <C> (this, 4);
|
||||
}
|
||||
|
||||
struct D : C {};
|
||||
struct D1 : virtual C {};
|
||||
struct D2 : virtual A, virtual C {};
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
fprintf (stderr, "C\n");
|
||||
C c;
|
||||
}
|
||||
{
|
||||
fprintf (stderr, "D\n");
|
||||
D d;
|
||||
}
|
||||
{
|
||||
fprintf (stderr, "D1\n");
|
||||
D1 d1;
|
||||
}
|
||||
{
|
||||
fprintf (stderr, "D2\n");
|
||||
D2 d2;
|
||||
}
|
||||
if (fail)
|
||||
fprintf (stderr, "There are %d failings\n", fail);
|
||||
else
|
||||
fprintf (stderr, "Passed\n");
|
||||
return fail ? 1 : 0;
|
||||
}
|
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3a.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3a.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS B1, B2
|
||||
|
||||
#include "vtable3.h"
|
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3b.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3b.C
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS B1, B2
|
||||
|
||||
#include "vtable3.h"
|
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3c.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3c.C
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS B1, B2
|
||||
|
||||
#include "vtable3.h"
|
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3d.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3d.C
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B1_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS B1, B2
|
||||
|
||||
#include "vtable3.h"
|
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3e.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3e.C
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_PARENTS B1, B2
|
||||
|
||||
#include "vtable3.h"
|
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3f.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3f.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS B1, virtual B2
|
||||
|
||||
#include "vtable3.h"
|
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3g.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3g.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS virtual B1, B2
|
||||
|
||||
#include "vtable3.h"
|
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3h.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.abi/vtable3h.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define A_EMPTY
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS virtual B1, virtual B2
|
||||
|
||||
#include "vtable3.h"
|
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3i.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3i.C
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS virtual B1, B2
|
||||
|
||||
#include "vtable3.h"
|
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3j.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.abi/vtable3j.C
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Check constructor vtables work.
|
||||
|
||||
#define B1_EMPTY
|
||||
#define B2_EMPTY
|
||||
#define C_EMPTY
|
||||
#define C_PARENTS virtual B1, virtual B2
|
||||
|
||||
#include "vtable3.h"
|
@ -4,7 +4,6 @@
|
||||
// based on bug report by Fredrik Öhrström <d92-foh@nada.kth.se>
|
||||
|
||||
// Special g++ Options: -fvtable-thunks
|
||||
// execution test - XFAIL *-*-*
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user