toplev.c (process_options): Reject -fabi-version=1.
gcc/ * toplev.c (process_options): Reject -fabi-version=1. gcc/cp/ * call.c (build_operator_new_call): Remove -fabi-version=1 support. * class.c (walk_subobject_offsets, include_empty_classes): Likewise. (layout_nonempty_base_or_field, end_of_class): Likewise. (layout_empty_base, build_base_field, layout_class_type): Likewise. (is_empty_class, add_vcall_offset_vtbl_entries_1): Likewise. (layout_virtual_bases): Likewise. * decl.c (compute_array_index_type): Likewise. * mangle.c (write_mangled_name, write_prefix): Likewise. (write_template_prefix, write_integer_cst, write_expression): Likewise. (write_template_arg, write_array_type): Likewise. * method.c (lazily_declare_fn): Likewise. * rtti.c (get_pseudo_ti_index): Likewise. * typeck.c (comp_array_types): Likewise. From-SVN: r211592
This commit is contained in:
parent
8fdcb6a997
commit
90d8493479
|
@ -1,3 +1,7 @@
|
|||
2014-06-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* toplev.c (process_options): Reject -fabi-version=1.
|
||||
|
||||
2014-06-12 Jeff Law <law@redhat.com>
|
||||
|
||||
PR tree-optimization/61009
|
||||
|
|
|
@ -776,7 +776,7 @@ Driver Undocumented
|
|||
; Therefore, 0 will not necessarily indicate the same ABI in different
|
||||
; versions of G++.
|
||||
;
|
||||
; 1: The version of the ABI first used in G++ 3.2.
|
||||
; 1: The version of the ABI first used in G++ 3.2. No longer selectable.
|
||||
;
|
||||
; 2: The version of the ABI first used in G++ 3.4 (and current default).
|
||||
;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
2014-06-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* call.c (build_operator_new_call): Remove -fabi-version=1 support.
|
||||
* class.c (walk_subobject_offsets, include_empty_classes): Likewise.
|
||||
(layout_nonempty_base_or_field, end_of_class): Likewise.
|
||||
(layout_empty_base, build_base_field, layout_class_type): Likewise.
|
||||
(is_empty_class, add_vcall_offset_vtbl_entries_1): Likewise.
|
||||
(layout_virtual_bases): Likewise.
|
||||
* decl.c (compute_array_index_type): Likewise.
|
||||
* mangle.c (write_mangled_name, write_prefix): Likewise.
|
||||
(write_template_prefix, write_integer_cst, write_expression): Likewise.
|
||||
(write_template_arg, write_array_type): Likewise.
|
||||
* method.c (lazily_declare_fn): Likewise.
|
||||
* rtti.c (get_pseudo_ti_index): Likewise.
|
||||
* typeck.c (comp_array_types): Likewise.
|
||||
|
||||
2014-06-11 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* vtable-class-hierarchy.c: Update handling for section names
|
||||
|
|
|
@ -4130,29 +4130,17 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
|
|||
if (*cookie_size)
|
||||
{
|
||||
bool use_cookie = true;
|
||||
if (!abi_version_at_least (2))
|
||||
{
|
||||
/* In G++ 3.2, the check was implemented incorrectly; it
|
||||
looked at the placement expression, rather than the
|
||||
type of the function. */
|
||||
if ((*args)->length () == 2
|
||||
&& same_type_p (TREE_TYPE ((**args)[1]), ptr_type_node))
|
||||
use_cookie = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree arg_types;
|
||||
tree arg_types;
|
||||
|
||||
arg_types = TYPE_ARG_TYPES (TREE_TYPE (cand->fn));
|
||||
/* Skip the size_t parameter. */
|
||||
arg_types = TREE_CHAIN (arg_types);
|
||||
/* Check the remaining parameters (if any). */
|
||||
if (arg_types
|
||||
&& TREE_CHAIN (arg_types) == void_list_node
|
||||
&& same_type_p (TREE_VALUE (arg_types),
|
||||
ptr_type_node))
|
||||
use_cookie = false;
|
||||
}
|
||||
arg_types = TYPE_ARG_TYPES (TREE_TYPE (cand->fn));
|
||||
/* Skip the size_t parameter. */
|
||||
arg_types = TREE_CHAIN (arg_types);
|
||||
/* Check the remaining parameters (if any). */
|
||||
if (arg_types
|
||||
&& TREE_CHAIN (arg_types) == void_list_node
|
||||
&& same_type_p (TREE_VALUE (arg_types),
|
||||
ptr_type_node))
|
||||
use_cookie = false;
|
||||
/* If we need a cookie, adjust the number of bytes allocated. */
|
||||
if (use_cookie)
|
||||
{
|
||||
|
|
342
gcc/cp/class.c
342
gcc/cp/class.c
|
@ -3820,8 +3820,7 @@ walk_subobject_offsets (tree type,
|
|||
|
||||
if (!TYPE_P (type))
|
||||
{
|
||||
if (abi_version_at_least (2))
|
||||
type_binfo = type;
|
||||
type_binfo = type;
|
||||
type = BINFO_TYPE (type);
|
||||
}
|
||||
|
||||
|
@ -3847,43 +3846,29 @@ walk_subobject_offsets (tree type,
|
|||
{
|
||||
tree binfo_offset;
|
||||
|
||||
if (abi_version_at_least (2)
|
||||
&& BINFO_VIRTUAL_P (binfo))
|
||||
if (BINFO_VIRTUAL_P (binfo))
|
||||
continue;
|
||||
|
||||
if (!vbases_p
|
||||
&& BINFO_VIRTUAL_P (binfo)
|
||||
&& !BINFO_PRIMARY_P (binfo))
|
||||
continue;
|
||||
|
||||
if (!abi_version_at_least (2))
|
||||
binfo_offset = size_binop (PLUS_EXPR,
|
||||
offset,
|
||||
BINFO_OFFSET (binfo));
|
||||
else
|
||||
{
|
||||
tree orig_binfo;
|
||||
/* We cannot rely on BINFO_OFFSET being set for the base
|
||||
class yet, but the offsets for direct non-virtual
|
||||
bases can be calculated by going back to the TYPE. */
|
||||
orig_binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
|
||||
binfo_offset = size_binop (PLUS_EXPR,
|
||||
offset,
|
||||
BINFO_OFFSET (orig_binfo));
|
||||
}
|
||||
tree orig_binfo;
|
||||
/* We cannot rely on BINFO_OFFSET being set for the base
|
||||
class yet, but the offsets for direct non-virtual
|
||||
bases can be calculated by going back to the TYPE. */
|
||||
orig_binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
|
||||
binfo_offset = size_binop (PLUS_EXPR,
|
||||
offset,
|
||||
BINFO_OFFSET (orig_binfo));
|
||||
|
||||
r = walk_subobject_offsets (binfo,
|
||||
f,
|
||||
binfo_offset,
|
||||
offsets,
|
||||
max_offset,
|
||||
(abi_version_at_least (2)
|
||||
? /*vbases_p=*/0 : vbases_p));
|
||||
/*vbases_p=*/0);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (abi_version_at_least (2) && CLASSTYPE_VBASECLASSES (type))
|
||||
if (CLASSTYPE_VBASECLASSES (type))
|
||||
{
|
||||
unsigned ix;
|
||||
vec<tree, va_gc> *vbases;
|
||||
|
@ -3936,11 +3921,7 @@ walk_subobject_offsets (tree type,
|
|||
{
|
||||
tree field_offset;
|
||||
|
||||
if (abi_version_at_least (2))
|
||||
field_offset = byte_position (field);
|
||||
else
|
||||
/* In G++ 3.2, DECL_FIELD_OFFSET was used. */
|
||||
field_offset = DECL_FIELD_OFFSET (field);
|
||||
field_offset = byte_position (field);
|
||||
|
||||
r = walk_subobject_offsets (TREE_TYPE (field),
|
||||
f,
|
||||
|
@ -3967,10 +3948,7 @@ walk_subobject_offsets (tree type,
|
|||
|
||||
/* Step through each of the elements in the array. */
|
||||
for (index = size_zero_node;
|
||||
/* G++ 3.2 had an off-by-one error here. */
|
||||
(abi_version_at_least (2)
|
||||
? !tree_int_cst_lt (TYPE_MAX_VALUE (domain), index)
|
||||
: tree_int_cst_lt (index, TYPE_MAX_VALUE (domain)));
|
||||
!tree_int_cst_lt (TYPE_MAX_VALUE (domain), index);
|
||||
index = size_binop (PLUS_EXPR, index, size_one_node))
|
||||
{
|
||||
r = walk_subobject_offsets (TREE_TYPE (type),
|
||||
|
@ -4114,10 +4092,6 @@ layout_nonempty_base_or_field (record_layout_info rli,
|
|||
offset zero. */
|
||||
if (TREE_CODE (rli->t) == UNION_TYPE)
|
||||
break;
|
||||
/* G++ 3.2 did not check for overlaps when placing a non-empty
|
||||
virtual base. */
|
||||
if (!abi_version_at_least (2) && binfo && BINFO_VIRTUAL_P (binfo))
|
||||
break;
|
||||
if (layout_conflict_p (field_p ? type : binfo, offset,
|
||||
offsets, field_p))
|
||||
{
|
||||
|
@ -4182,17 +4156,9 @@ layout_empty_base (record_layout_info rli, tree binfo,
|
|||
alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype));
|
||||
|
||||
if (!integer_zerop (BINFO_OFFSET (binfo)))
|
||||
{
|
||||
if (abi_version_at_least (2))
|
||||
propagate_binfo_offsets
|
||||
(binfo, size_diffop_loc (input_location,
|
||||
propagate_binfo_offsets
|
||||
(binfo, size_diffop_loc (input_location,
|
||||
size_zero_node, BINFO_OFFSET (binfo)));
|
||||
else
|
||||
warning (OPT_Wabi,
|
||||
"offset of empty base %qT may not be ABI-compliant and may"
|
||||
"change in a future version of GCC",
|
||||
BINFO_TYPE (binfo));
|
||||
}
|
||||
|
||||
/* This is an empty base class. We first try to put it at offset
|
||||
zero. */
|
||||
|
@ -4311,14 +4277,7 @@ build_base_field (record_layout_info rli, tree binfo,
|
|||
/*offsets=*/NULL,
|
||||
/*max_offset=*/NULL_TREE,
|
||||
/*vbases_p=*/true))
|
||||
{
|
||||
if (abi_version_at_least (2))
|
||||
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
||||
else
|
||||
warning (OPT_Wabi,
|
||||
"class %qT will be considered nearly empty in a "
|
||||
"future version of GCC", t);
|
||||
}
|
||||
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
||||
}
|
||||
|
||||
/* We do not create a FIELD_DECL for empty base classes because
|
||||
|
@ -5808,27 +5767,11 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
|
|||
{
|
||||
tree vbase;
|
||||
tree t = rli->t;
|
||||
bool first_vbase = true;
|
||||
tree *next_field;
|
||||
|
||||
if (BINFO_N_BASE_BINFOS (TYPE_BINFO (t)) == 0)
|
||||
return;
|
||||
|
||||
if (!abi_version_at_least(2))
|
||||
{
|
||||
/* In G++ 3.2, we incorrectly rounded the size before laying out
|
||||
the virtual bases. */
|
||||
finish_record_layout (rli, /*free_p=*/false);
|
||||
#ifdef STRUCTURE_SIZE_BOUNDARY
|
||||
/* Packed structures don't need to have minimum size. */
|
||||
if (! TYPE_PACKED (t))
|
||||
TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), (unsigned) STRUCTURE_SIZE_BOUNDARY);
|
||||
#endif
|
||||
rli->offset = TYPE_SIZE_UNIT (t);
|
||||
rli->bitpos = bitsize_zero_node;
|
||||
rli->record_align = TYPE_ALIGN (t);
|
||||
}
|
||||
|
||||
/* Find the last field. The artificial fields created for virtual
|
||||
bases will go after the last extant field to date. */
|
||||
next_field = &TYPE_FIELDS (t);
|
||||
|
@ -5845,35 +5788,10 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
|
|||
|
||||
if (!BINFO_PRIMARY_P (vbase))
|
||||
{
|
||||
tree basetype = TREE_TYPE (vbase);
|
||||
|
||||
/* This virtual base is not a primary base of any class in the
|
||||
hierarchy, so we have to add space for it. */
|
||||
next_field = build_base_field (rli, vbase,
|
||||
offsets, next_field);
|
||||
|
||||
/* If the first virtual base might have been placed at a
|
||||
lower address, had we started from CLASSTYPE_SIZE, rather
|
||||
than TYPE_SIZE, issue a warning. There can be both false
|
||||
positives and false negatives from this warning in rare
|
||||
cases; to deal with all the possibilities would probably
|
||||
require performing both layout algorithms and comparing
|
||||
the results which is not particularly tractable. */
|
||||
if (warn_abi
|
||||
&& first_vbase
|
||||
&& (tree_int_cst_lt
|
||||
(size_binop (CEIL_DIV_EXPR,
|
||||
round_up_loc (input_location,
|
||||
CLASSTYPE_SIZE (t),
|
||||
CLASSTYPE_ALIGN (basetype)),
|
||||
bitsize_unit_node),
|
||||
BINFO_OFFSET (vbase))))
|
||||
warning (OPT_Wabi,
|
||||
"offset of virtual base %qT is not ABI-compliant and "
|
||||
"may change in a future version of GCC",
|
||||
basetype);
|
||||
|
||||
first_vbase = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5927,8 +5845,7 @@ end_of_class (tree t, int include_virtuals_p)
|
|||
result = offset;
|
||||
}
|
||||
|
||||
/* G++ 3.2 did not check indirect virtual bases. */
|
||||
if (abi_version_at_least (2) && include_virtuals_p)
|
||||
if (include_virtuals_p)
|
||||
for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
|
||||
vec_safe_iterate (vbases, i, &base_binfo); i++)
|
||||
{
|
||||
|
@ -6015,17 +5932,9 @@ include_empty_classes (record_layout_info rli)
|
|||
if (TREE_CODE (rli_size) == INTEGER_CST
|
||||
&& tree_int_cst_lt (rli_size, eoc))
|
||||
{
|
||||
if (!abi_version_at_least (2))
|
||||
/* In version 1 of the ABI, the size of a class that ends with
|
||||
a bitfield was not rounded up to a whole multiple of a
|
||||
byte. Because rli_size_unit_so_far returns only the number
|
||||
of fully allocated bytes, any extra bits were not included
|
||||
in the size. */
|
||||
rli->bitpos = round_down (rli->bitpos, BITS_PER_UNIT);
|
||||
else
|
||||
/* The size should have been rounded to a whole byte. */
|
||||
gcc_assert (tree_int_cst_equal
|
||||
(rli->bitpos, round_down (rli->bitpos, BITS_PER_UNIT)));
|
||||
/* The size should have been rounded to a whole byte. */
|
||||
gcc_assert (tree_int_cst_equal
|
||||
(rli->bitpos, round_down (rli->bitpos, BITS_PER_UNIT)));
|
||||
rli->bitpos
|
||||
= size_binop (PLUS_EXPR,
|
||||
rli->bitpos,
|
||||
|
@ -6155,26 +6064,16 @@ layout_class_type (tree t, tree *virtuals_p)
|
|||
integer_type = integer_types[itk];
|
||||
} while (itk > 0 && integer_type == NULL_TREE);
|
||||
|
||||
/* Figure out how much additional padding is required. GCC
|
||||
3.2 always created a padding field, even if it had zero
|
||||
width. */
|
||||
if (!abi_version_at_least (2)
|
||||
|| tree_int_cst_lt (TYPE_SIZE (integer_type), DECL_SIZE (field)))
|
||||
/* Figure out how much additional padding is required. */
|
||||
if (tree_int_cst_lt (TYPE_SIZE (integer_type), DECL_SIZE (field)))
|
||||
{
|
||||
if (abi_version_at_least (2) && TREE_CODE (t) == UNION_TYPE)
|
||||
if (TREE_CODE (t) == UNION_TYPE)
|
||||
/* In a union, the padding field must have the full width
|
||||
of the bit-field; all fields start at offset zero. */
|
||||
padding = DECL_SIZE (field);
|
||||
else
|
||||
{
|
||||
if (TREE_CODE (t) == UNION_TYPE)
|
||||
warning (OPT_Wabi, "size assigned to %qT may not be "
|
||||
"ABI-compliant and may change in a future "
|
||||
"version of GCC",
|
||||
t);
|
||||
padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
|
||||
TYPE_SIZE (integer_type));
|
||||
}
|
||||
padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
|
||||
TYPE_SIZE (integer_type));
|
||||
}
|
||||
#ifdef PCC_BITFIELD_TYPE_MATTERS
|
||||
/* An unnamed bitfield does not normally affect the
|
||||
|
@ -6201,26 +6100,17 @@ layout_class_type (tree t, tree *virtuals_p)
|
|||
field is effectively invisible. */
|
||||
DECL_SIZE (field) = TYPE_SIZE (type);
|
||||
/* We must also reset the DECL_MODE of the field. */
|
||||
if (abi_version_at_least (2))
|
||||
DECL_MODE (field) = TYPE_MODE (type);
|
||||
else if (warn_abi
|
||||
&& DECL_MODE (field) != TYPE_MODE (type))
|
||||
/* Versions of G++ before G++ 3.4 did not reset the
|
||||
DECL_MODE. */
|
||||
warning (OPT_Wabi,
|
||||
"the offset of %qD may not be ABI-compliant and may "
|
||||
"change in a future version of GCC", field);
|
||||
DECL_MODE (field) = TYPE_MODE (type);
|
||||
}
|
||||
else
|
||||
layout_nonempty_base_or_field (rli, field, NULL_TREE,
|
||||
empty_base_offsets);
|
||||
|
||||
/* Remember the location of any empty classes in FIELD. */
|
||||
if (abi_version_at_least (2))
|
||||
record_subobject_offsets (TREE_TYPE (field),
|
||||
byte_position(field),
|
||||
empty_base_offsets,
|
||||
/*is_data_member=*/true);
|
||||
record_subobject_offsets (TREE_TYPE (field),
|
||||
byte_position(field),
|
||||
empty_base_offsets,
|
||||
/*is_data_member=*/true);
|
||||
|
||||
/* If a bit-field does not immediately follow another bit-field,
|
||||
and yet it starts in the middle of a byte, we have failed to
|
||||
|
@ -6239,17 +6129,6 @@ layout_class_type (tree t, tree *virtuals_p)
|
|||
warning (OPT_Wabi, "offset of %q+D is not ABI-compliant and may "
|
||||
"change in a future version of GCC", field);
|
||||
|
||||
/* G++ used to use DECL_FIELD_OFFSET as if it were the byte
|
||||
offset of the field. */
|
||||
if (warn_abi
|
||||
&& !abi_version_at_least (2)
|
||||
&& !tree_int_cst_equal (DECL_FIELD_OFFSET (field),
|
||||
byte_position (field))
|
||||
&& contains_empty_class_p (TREE_TYPE (field)))
|
||||
warning (OPT_Wabi, "%q+D contains empty classes which may cause base "
|
||||
"classes to be placed at different locations in a "
|
||||
"future version of GCC", field);
|
||||
|
||||
/* The middle end uses the type of expressions to determine the
|
||||
possible range of expression values. In order to optimize
|
||||
"x.i > 7" to "false" for a 2-bit bitfield "i", the middle end
|
||||
|
@ -6300,7 +6179,7 @@ layout_class_type (tree t, tree *virtuals_p)
|
|||
last_field_was_bitfield = DECL_C_BIT_FIELD (field);
|
||||
}
|
||||
|
||||
if (abi_version_at_least (2) && !integer_zerop (rli->bitpos))
|
||||
if (!integer_zerop (rli->bitpos))
|
||||
{
|
||||
/* Make sure that we are on a byte boundary so that the size of
|
||||
the class without virtual bases will always be a round number
|
||||
|
@ -6309,11 +6188,6 @@ layout_class_type (tree t, tree *virtuals_p)
|
|||
normalize_rli (rli);
|
||||
}
|
||||
|
||||
/* G++ 3.2 does not allow virtual bases to be overlaid with tail
|
||||
padding. */
|
||||
if (!abi_version_at_least (2))
|
||||
include_empty_classes(rli);
|
||||
|
||||
/* Delete all zero-width bit-fields from the list of fields. Now
|
||||
that the type is laid out they are no longer important. */
|
||||
remove_zero_width_bit_fields (t);
|
||||
|
@ -6325,45 +6199,30 @@ layout_class_type (tree t, tree *virtuals_p)
|
|||
{
|
||||
base_t = make_node (TREE_CODE (t));
|
||||
|
||||
/* Set the size and alignment for the new type. In G++ 3.2, all
|
||||
empty classes were considered to have size zero when used as
|
||||
base classes. */
|
||||
if (!abi_version_at_least (2) && CLASSTYPE_EMPTY_P (t))
|
||||
{
|
||||
TYPE_SIZE (base_t) = bitsize_zero_node;
|
||||
TYPE_SIZE_UNIT (base_t) = size_zero_node;
|
||||
if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli)))
|
||||
warning (OPT_Wabi,
|
||||
"layout of classes derived from empty class %qT "
|
||||
"may change in a future version of GCC",
|
||||
t);
|
||||
}
|
||||
else
|
||||
{
|
||||
tree eoc;
|
||||
/* Set the size and alignment for the new type. */
|
||||
tree eoc;
|
||||
|
||||
/* If the ABI version is not at least two, and the last
|
||||
field was a bit-field, RLI may not be on a byte
|
||||
boundary. In particular, rli_size_unit_so_far might
|
||||
indicate the last complete byte, while rli_size_so_far
|
||||
indicates the total number of bits used. Therefore,
|
||||
rli_size_so_far, rather than rli_size_unit_so_far, is
|
||||
used to compute TYPE_SIZE_UNIT. */
|
||||
eoc = end_of_class (t, /*include_virtuals_p=*/0);
|
||||
TYPE_SIZE_UNIT (base_t)
|
||||
= size_binop (MAX_EXPR,
|
||||
convert (sizetype,
|
||||
size_binop (CEIL_DIV_EXPR,
|
||||
rli_size_so_far (rli),
|
||||
bitsize_int (BITS_PER_UNIT))),
|
||||
eoc);
|
||||
TYPE_SIZE (base_t)
|
||||
= size_binop (MAX_EXPR,
|
||||
rli_size_so_far (rli),
|
||||
size_binop (MULT_EXPR,
|
||||
convert (bitsizetype, eoc),
|
||||
bitsize_int (BITS_PER_UNIT)));
|
||||
}
|
||||
/* If the ABI version is not at least two, and the last
|
||||
field was a bit-field, RLI may not be on a byte
|
||||
boundary. In particular, rli_size_unit_so_far might
|
||||
indicate the last complete byte, while rli_size_so_far
|
||||
indicates the total number of bits used. Therefore,
|
||||
rli_size_so_far, rather than rli_size_unit_so_far, is
|
||||
used to compute TYPE_SIZE_UNIT. */
|
||||
eoc = end_of_class (t, /*include_virtuals_p=*/0);
|
||||
TYPE_SIZE_UNIT (base_t)
|
||||
= size_binop (MAX_EXPR,
|
||||
convert (sizetype,
|
||||
size_binop (CEIL_DIV_EXPR,
|
||||
rli_size_so_far (rli),
|
||||
bitsize_int (BITS_PER_UNIT))),
|
||||
eoc);
|
||||
TYPE_SIZE (base_t)
|
||||
= size_binop (MAX_EXPR,
|
||||
rli_size_so_far (rli),
|
||||
size_binop (MULT_EXPR,
|
||||
convert (bitsizetype, eoc),
|
||||
bitsize_int (BITS_PER_UNIT)));
|
||||
TYPE_ALIGN (base_t) = rli->record_align;
|
||||
TYPE_USER_ALIGN (base_t) = TYPE_USER_ALIGN (t);
|
||||
|
||||
|
@ -7908,12 +7767,7 @@ is_empty_class (tree type)
|
|||
if (! CLASS_TYPE_P (type))
|
||||
return 0;
|
||||
|
||||
/* In G++ 3.2, whether or not a class was empty was determined by
|
||||
looking at its size. */
|
||||
if (abi_version_at_least (2))
|
||||
return CLASSTYPE_EMPTY_P (type);
|
||||
else
|
||||
return integer_zerop (CLASSTYPE_SIZE (type));
|
||||
return CLASSTYPE_EMPTY_P (type);
|
||||
}
|
||||
|
||||
/* Returns true if TYPE contains an empty class. */
|
||||
|
@ -9278,83 +9132,15 @@ static void
|
|||
add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid)
|
||||
{
|
||||
/* Make entries for the rest of the virtuals. */
|
||||
if (abi_version_at_least (2))
|
||||
{
|
||||
tree orig_fn;
|
||||
tree orig_fn;
|
||||
|
||||
/* The ABI requires that the methods be processed in declaration
|
||||
order. G++ 3.2 used the order in the vtable. */
|
||||
for (orig_fn = TYPE_METHODS (BINFO_TYPE (binfo));
|
||||
orig_fn;
|
||||
orig_fn = DECL_CHAIN (orig_fn))
|
||||
if (DECL_VINDEX (orig_fn))
|
||||
add_vcall_offset (orig_fn, binfo, vid);
|
||||
}
|
||||
else
|
||||
{
|
||||
tree derived_virtuals;
|
||||
tree base_virtuals;
|
||||
tree orig_virtuals;
|
||||
/* If BINFO is a primary base, the most derived class which has
|
||||
BINFO as a primary base; otherwise, just BINFO. */
|
||||
tree non_primary_binfo;
|
||||
|
||||
/* We might be a primary base class. Go up the inheritance hierarchy
|
||||
until we find the most derived class of which we are a primary base:
|
||||
it is the BINFO_VIRTUALS there that we need to consider. */
|
||||
non_primary_binfo = binfo;
|
||||
while (BINFO_INHERITANCE_CHAIN (non_primary_binfo))
|
||||
{
|
||||
tree b;
|
||||
|
||||
/* If we have reached a virtual base, then it must be vid->vbase,
|
||||
because we ignore other virtual bases in
|
||||
add_vcall_offset_vtbl_entries_r. In turn, it must be a primary
|
||||
base (possibly multi-level) of vid->binfo, or we wouldn't
|
||||
have called build_vcall_and_vbase_vtbl_entries for it. But it
|
||||
might be a lost primary, so just skip down to vid->binfo. */
|
||||
if (BINFO_VIRTUAL_P (non_primary_binfo))
|
||||
{
|
||||
gcc_assert (non_primary_binfo == vid->vbase);
|
||||
non_primary_binfo = vid->binfo;
|
||||
break;
|
||||
}
|
||||
|
||||
b = BINFO_INHERITANCE_CHAIN (non_primary_binfo);
|
||||
if (get_primary_binfo (b) != non_primary_binfo)
|
||||
break;
|
||||
non_primary_binfo = b;
|
||||
}
|
||||
|
||||
if (vid->ctor_vtbl_p)
|
||||
/* For a ctor vtable we need the equivalent binfo within the hierarchy
|
||||
where rtti_binfo is the most derived type. */
|
||||
non_primary_binfo
|
||||
= original_binfo (non_primary_binfo, vid->rtti_binfo);
|
||||
|
||||
for (base_virtuals = BINFO_VIRTUALS (binfo),
|
||||
derived_virtuals = BINFO_VIRTUALS (non_primary_binfo),
|
||||
orig_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
|
||||
base_virtuals;
|
||||
base_virtuals = TREE_CHAIN (base_virtuals),
|
||||
derived_virtuals = TREE_CHAIN (derived_virtuals),
|
||||
orig_virtuals = TREE_CHAIN (orig_virtuals))
|
||||
{
|
||||
tree orig_fn;
|
||||
|
||||
/* Find the declaration that originally caused this function to
|
||||
be present in BINFO_TYPE (binfo). */
|
||||
orig_fn = BV_FN (orig_virtuals);
|
||||
|
||||
/* When processing BINFO, we only want to generate vcall slots for
|
||||
function slots introduced in BINFO. So don't try to generate
|
||||
one if the function isn't even defined in BINFO. */
|
||||
if (!SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), DECL_CONTEXT (orig_fn)))
|
||||
continue;
|
||||
|
||||
add_vcall_offset (orig_fn, binfo, vid);
|
||||
}
|
||||
}
|
||||
/* The ABI requires that the methods be processed in declaration
|
||||
order. */
|
||||
for (orig_fn = TYPE_METHODS (BINFO_TYPE (binfo));
|
||||
orig_fn;
|
||||
orig_fn = DECL_CHAIN (orig_fn))
|
||||
if (DECL_VINDEX (orig_fn))
|
||||
add_vcall_offset (orig_fn, binfo, vid);
|
||||
}
|
||||
|
||||
/* Add a vcall offset entry for ORIG_FN to the vtable. */
|
||||
|
|
|
@ -8268,7 +8268,6 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
|||
{
|
||||
tree itype;
|
||||
tree osize = size;
|
||||
tree abi_1_itype = NULL_TREE;
|
||||
|
||||
if (error_operand_p (size))
|
||||
return error_mark_node;
|
||||
|
@ -8305,9 +8304,6 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
|||
if (size == error_mark_node)
|
||||
return error_mark_node;
|
||||
type = TREE_TYPE (size);
|
||||
/* We didn't support this case in GCC 3.2, so don't bother
|
||||
trying to model it now in ABI v1. */
|
||||
abi_1_itype = error_mark_node;
|
||||
}
|
||||
|
||||
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
|
||||
|
@ -8354,17 +8350,6 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
|||
return itype;
|
||||
}
|
||||
|
||||
if (!abi_version_at_least (2) && processing_template_decl
|
||||
&& abi_1_itype == NULL_TREE)
|
||||
/* For abi-1, we handled all instances in templates the same way,
|
||||
even when they were non-dependent. This affects the manglings
|
||||
produced. So, we do the normal checking for non-dependent
|
||||
sizes, but at the end we'll return the same type that abi-1
|
||||
would have, but with TYPE_CANONICAL set to the "right"
|
||||
value that the current ABI would provide. */
|
||||
abi_1_itype = build_index_type (build_min (MINUS_EXPR, sizetype,
|
||||
osize, integer_one_node));
|
||||
|
||||
/* Normally, the array-bound will be a constant. */
|
||||
if (TREE_CODE (size) == INTEGER_CST)
|
||||
{
|
||||
|
@ -8510,14 +8495,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
|||
}
|
||||
|
||||
/* Create and return the appropriate index type. */
|
||||
if (abi_1_itype && abi_1_itype != error_mark_node)
|
||||
{
|
||||
tree t = build_index_type (itype);
|
||||
TYPE_CANONICAL (abi_1_itype) = TYPE_CANONICAL (t);
|
||||
itype = abi_1_itype;
|
||||
}
|
||||
else
|
||||
itype = build_index_type (itype);
|
||||
itype = build_index_type (itype);
|
||||
|
||||
/* If the index type were dependent, we would have returned early, so
|
||||
remember that it isn't. */
|
||||
|
|
121
gcc/cp/mangle.c
121
gcc/cp/mangle.c
|
@ -663,10 +663,7 @@ write_mangled_name (const tree decl, bool top_level)
|
|||
<source-name> without a type." We cannot write
|
||||
overloaded operators that way though, because it contains
|
||||
characters invalid in assembler. */
|
||||
if (abi_version_at_least (2))
|
||||
write_string ("_Z");
|
||||
else
|
||||
G.need_abi_warning = true;
|
||||
write_string ("_Z");
|
||||
write_source_name (DECL_NAME (decl));
|
||||
}
|
||||
}
|
||||
|
@ -677,17 +674,10 @@ write_mangled_name (const tree decl, bool top_level)
|
|||
/* And neither are `extern "C"' variables. */
|
||||
|| DECL_EXTERN_C_P (decl)))
|
||||
{
|
||||
if (top_level || abi_version_at_least (2))
|
||||
goto unmangled_name;
|
||||
else
|
||||
{
|
||||
G.need_abi_warning = true;
|
||||
goto mangled_name;
|
||||
}
|
||||
goto unmangled_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
mangled_name:;
|
||||
write_string ("_Z");
|
||||
write_encoding (decl);
|
||||
}
|
||||
|
@ -1020,13 +1010,7 @@ write_prefix (const tree node)
|
|||
template_info = TYPE_TEMPLATE_INFO (node);
|
||||
}
|
||||
|
||||
/* In G++ 3.2, the name of the template parameter was used. */
|
||||
if (TREE_CODE (node) == TEMPLATE_TYPE_PARM
|
||||
&& !abi_version_at_least (2))
|
||||
G.need_abi_warning = true;
|
||||
|
||||
if (TREE_CODE (node) == TEMPLATE_TYPE_PARM
|
||||
&& abi_version_at_least (2))
|
||||
if (TREE_CODE (node) == TEMPLATE_TYPE_PARM)
|
||||
write_template_param (node);
|
||||
else if (template_info != NULL)
|
||||
/* Templated. */
|
||||
|
@ -1124,15 +1108,8 @@ write_template_prefix (const tree node)
|
|||
if (find_substitution (substitution))
|
||||
return;
|
||||
|
||||
/* In G++ 3.2, the name of the template template parameter was used. */
|
||||
if (TREE_TYPE (templ)
|
||||
&& TREE_CODE (TREE_TYPE (templ)) == TEMPLATE_TEMPLATE_PARM
|
||||
&& !abi_version_at_least (2))
|
||||
G.need_abi_warning = true;
|
||||
|
||||
if (TREE_TYPE (templ)
|
||||
&& TREE_CODE (TREE_TYPE (templ)) == TEMPLATE_TEMPLATE_PARM
|
||||
&& abi_version_at_least (2))
|
||||
&& TREE_CODE (TREE_TYPE (templ)) == TEMPLATE_TEMPLATE_PARM)
|
||||
write_template_param (TREE_TYPE (templ));
|
||||
else
|
||||
{
|
||||
|
@ -1597,45 +1574,29 @@ write_integer_cst (const tree cst)
|
|||
static void
|
||||
write_real_cst (const tree value)
|
||||
{
|
||||
if (abi_version_at_least (2))
|
||||
{
|
||||
long target_real[4]; /* largest supported float */
|
||||
char buffer[9]; /* eight hex digits in a 32-bit number */
|
||||
int i, limit, dir;
|
||||
long target_real[4]; /* largest supported float */
|
||||
char buffer[9]; /* eight hex digits in a 32-bit number */
|
||||
int i, limit, dir;
|
||||
|
||||
tree type = TREE_TYPE (value);
|
||||
int words = GET_MODE_BITSIZE (TYPE_MODE (type)) / 32;
|
||||
tree type = TREE_TYPE (value);
|
||||
int words = GET_MODE_BITSIZE (TYPE_MODE (type)) / 32;
|
||||
|
||||
real_to_target (target_real, &TREE_REAL_CST (value),
|
||||
TYPE_MODE (type));
|
||||
real_to_target (target_real, &TREE_REAL_CST (value),
|
||||
TYPE_MODE (type));
|
||||
|
||||
/* The value in target_real is in the target word order,
|
||||
so we must write it out backward if that happens to be
|
||||
little-endian. write_number cannot be used, it will
|
||||
produce uppercase. */
|
||||
if (FLOAT_WORDS_BIG_ENDIAN)
|
||||
i = 0, limit = words, dir = 1;
|
||||
else
|
||||
i = words - 1, limit = -1, dir = -1;
|
||||
|
||||
for (; i != limit; i += dir)
|
||||
{
|
||||
sprintf (buffer, "%08lx", (unsigned long) target_real[i]);
|
||||
write_chars (buffer, 8);
|
||||
}
|
||||
}
|
||||
/* The value in target_real is in the target word order,
|
||||
so we must write it out backward if that happens to be
|
||||
little-endian. write_number cannot be used, it will
|
||||
produce uppercase. */
|
||||
if (FLOAT_WORDS_BIG_ENDIAN)
|
||||
i = 0, limit = words, dir = 1;
|
||||
else
|
||||
i = words - 1, limit = -1, dir = -1;
|
||||
|
||||
for (; i != limit; i += dir)
|
||||
{
|
||||
/* In G++ 3.3 and before the REAL_VALUE_TYPE was written out
|
||||
literally. Note that compatibility with 3.2 is impossible,
|
||||
because the old floating-point emulator used a different
|
||||
format for REAL_VALUE_TYPE. */
|
||||
size_t i;
|
||||
for (i = 0; i < sizeof (TREE_REAL_CST (value)); ++i)
|
||||
write_number (((unsigned char *) &TREE_REAL_CST (value))[i],
|
||||
/*unsigned_p*/ 1,
|
||||
/*base*/ 16);
|
||||
G.need_abi_warning = 1;
|
||||
sprintf (buffer, "%08lx", (unsigned long) target_real[i]);
|
||||
write_chars (buffer, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2631,7 +2592,7 @@ write_expression (tree expr)
|
|||
write_template_param (expr);
|
||||
/* Handle literals. */
|
||||
else if (TREE_CODE_CLASS (code) == tcc_constant
|
||||
|| (abi_version_at_least (2) && code == CONST_DECL))
|
||||
|| code == CONST_DECL)
|
||||
write_template_arg_literal (expr);
|
||||
else if (code == PARM_DECL && DECL_ARTIFICIAL (expr))
|
||||
{
|
||||
|
@ -2668,10 +2629,6 @@ write_expression (tree expr)
|
|||
}
|
||||
else if (DECL_P (expr))
|
||||
{
|
||||
/* G++ 3.2 incorrectly mangled non-type template arguments of
|
||||
enumeration type using their names. */
|
||||
if (code == CONST_DECL)
|
||||
G.need_abi_warning = 1;
|
||||
write_char ('L');
|
||||
write_mangled_name (expr, false);
|
||||
write_char ('E');
|
||||
|
@ -2709,22 +2666,12 @@ write_expression (tree expr)
|
|||
member = BASELINK_FUNCTIONS (expr);
|
||||
}
|
||||
|
||||
if (!abi_version_at_least (2) && DECL_P (member))
|
||||
{
|
||||
write_string ("sr");
|
||||
write_type (scope);
|
||||
/* G++ 3.2 incorrectly put out both the "sr" code and
|
||||
the nested name of the qualified name. */
|
||||
G.need_abi_warning = 1;
|
||||
write_encoding (member);
|
||||
}
|
||||
|
||||
/* If the MEMBER is a real declaration, then the qualifying
|
||||
scope was not dependent. Ideally, we would not have a
|
||||
SCOPE_REF in those cases, but sometimes we do. If the second
|
||||
argument is a DECL, then the name must not have been
|
||||
dependent. */
|
||||
else if (DECL_P (member))
|
||||
if (DECL_P (member))
|
||||
write_expression (member);
|
||||
else
|
||||
{
|
||||
|
@ -3109,10 +3056,7 @@ write_template_arg (tree node)
|
|||
internal consistency, such arguments use a conversion from
|
||||
address of object to reference type. */
|
||||
gcc_assert (TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR);
|
||||
if (abi_version_at_least (2))
|
||||
node = TREE_OPERAND (TREE_OPERAND (node, 0), 0);
|
||||
else
|
||||
G.need_abi_warning = 1;
|
||||
node = TREE_OPERAND (TREE_OPERAND (node, 0), 0);
|
||||
}
|
||||
|
||||
if (TREE_CODE (node) == BASELINK
|
||||
|
@ -3147,15 +3091,11 @@ write_template_arg (tree node)
|
|||
/* A template appearing as a template arg is a template template arg. */
|
||||
write_template_template_arg (node);
|
||||
else if ((TREE_CODE_CLASS (code) == tcc_constant && code != PTRMEM_CST)
|
||||
|| (abi_version_at_least (2) && code == CONST_DECL)
|
||||
|| code == CONST_DECL
|
||||
|| null_member_pointer_value_p (node))
|
||||
write_template_arg_literal (node);
|
||||
else if (DECL_P (node))
|
||||
{
|
||||
/* Until ABI version 2, non-type template arguments of
|
||||
enumeration type were mangled using their names. */
|
||||
if (code == CONST_DECL && !abi_version_at_least (2))
|
||||
G.need_abi_warning = 1;
|
||||
write_char ('L');
|
||||
/* Until ABI version 3, the underscore before the mangled name
|
||||
was incorrectly omitted. */
|
||||
|
@ -3230,15 +3170,6 @@ write_array_type (const tree type)
|
|||
else
|
||||
{
|
||||
max = TREE_OPERAND (max, 0);
|
||||
if (!abi_version_at_least (2))
|
||||
{
|
||||
/* value_dependent_expression_p presumes nothing is
|
||||
dependent when PROCESSING_TEMPLATE_DECL is zero. */
|
||||
++processing_template_decl;
|
||||
if (!value_dependent_expression_p (max))
|
||||
G.need_abi_warning = 1;
|
||||
--processing_template_decl;
|
||||
}
|
||||
write_expression (max);
|
||||
}
|
||||
|
||||
|
|
|
@ -2067,21 +2067,12 @@ lazily_declare_fn (special_function_kind sfk, tree type)
|
|||
add_method (type, fn, NULL_TREE);
|
||||
/* Add it to TYPE_METHODS. */
|
||||
if (sfk == sfk_destructor
|
||||
&& DECL_VIRTUAL_P (fn)
|
||||
&& abi_version_at_least (2))
|
||||
&& DECL_VIRTUAL_P (fn))
|
||||
/* The ABI requires that a virtual destructor go at the end of the
|
||||
vtable. */
|
||||
TYPE_METHODS (type) = chainon (TYPE_METHODS (type), fn);
|
||||
else
|
||||
{
|
||||
/* G++ 3.2 put the implicit destructor at the *beginning* of the
|
||||
TYPE_METHODS list, which cause the destructor to be emitted
|
||||
in an incorrect location in the vtable. */
|
||||
if (warn_abi && sfk == sfk_destructor && DECL_VIRTUAL_P (fn))
|
||||
warning (OPT_Wabi, "vtable layout for class %qT may not be ABI-compliant"
|
||||
"and may change in a future version of GCC due to "
|
||||
"implicit virtual destructor",
|
||||
type);
|
||||
DECL_CHAIN (fn) = TYPE_METHODS (type);
|
||||
TYPE_METHODS (type) = fn;
|
||||
}
|
||||
|
|
|
@ -1331,14 +1331,8 @@ get_pseudo_ti_index (tree type)
|
|||
/* already created. */
|
||||
break;
|
||||
|
||||
/* Create the array of __base_class_type_info entries.
|
||||
G++ 3.2 allocated an array that had one too many
|
||||
entries, and then filled that extra entries with
|
||||
zeros. */
|
||||
if (abi_version_at_least (2))
|
||||
array_domain = build_index_type (size_int (num_bases - 1));
|
||||
else
|
||||
array_domain = build_index_type (size_int (num_bases));
|
||||
/* Create the array of __base_class_type_info entries. */
|
||||
array_domain = build_index_type (size_int (num_bases - 1));
|
||||
base_array = build_array_type ((*tinfo_descs)[TK_BASE_TYPE].type,
|
||||
array_domain);
|
||||
|
||||
|
|
|
@ -1114,17 +1114,6 @@ comp_array_types (const_tree t1, const_tree t2, bool allow_redeclaration)
|
|||
return false;
|
||||
max1 = TYPE_MAX_VALUE (d1);
|
||||
max2 = TYPE_MAX_VALUE (d2);
|
||||
if (processing_template_decl && !abi_version_at_least (2)
|
||||
&& !value_dependent_expression_p (max1)
|
||||
&& !value_dependent_expression_p (max2))
|
||||
{
|
||||
/* With abi-1 we do not fold non-dependent array bounds, (and
|
||||
consequently mangle them incorrectly). We must therefore
|
||||
fold them here, to verify the domains have the same
|
||||
value. */
|
||||
max1 = fold (max1);
|
||||
max2 = fold (max2);
|
||||
}
|
||||
|
||||
if (!cp_tree_equal (max1, max2))
|
||||
return false;
|
||||
|
|
|
@ -2479,92 +2479,6 @@ functions taking vectors of different sizes.
|
|||
The mangling is changed in @option{-fabi-version=4}.
|
||||
@end itemize
|
||||
|
||||
The known incompatibilities in @option{-fabi-version=1} include:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Incorrect handling of tail-padding for bit-fields. G++ may attempt to
|
||||
pack data into the same byte as a base class. For example:
|
||||
|
||||
@smallexample
|
||||
struct A @{ virtual void f(); int f1 : 1; @};
|
||||
struct B : public A @{ int f2 : 1; @};
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
In this case, G++ places @code{B::f2} into the same byte
|
||||
as @code{A::f1}; other compilers do not. You can avoid this problem
|
||||
by explicitly padding @code{A} so that its size is a multiple of the
|
||||
byte size on your platform; that causes G++ and other compilers to
|
||||
lay out @code{B} identically.
|
||||
|
||||
@item
|
||||
Incorrect handling of tail-padding for virtual bases. G++ does not use
|
||||
tail padding when laying out virtual bases. For example:
|
||||
|
||||
@smallexample
|
||||
struct A @{ virtual void f(); char c1; @};
|
||||
struct B @{ B(); char c2; @};
|
||||
struct C : public A, public virtual B @{@};
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
In this case, G++ does not place @code{B} into the tail-padding for
|
||||
@code{A}; other compilers do. You can avoid this problem by
|
||||
explicitly padding @code{A} so that its size is a multiple of its
|
||||
alignment (ignoring virtual base classes); that causes G++ and other
|
||||
compilers to lay out @code{C} identically.
|
||||
|
||||
@item
|
||||
Incorrect handling of bit-fields with declared widths greater than that
|
||||
of their underlying types, when the bit-fields appear in a union. For
|
||||
example:
|
||||
|
||||
@smallexample
|
||||
union U @{ int i : 4096; @};
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Assuming that an @code{int} does not have 4096 bits, G++ makes the
|
||||
union too small by the number of bits in an @code{int}.
|
||||
|
||||
@item
|
||||
Empty classes can be placed at incorrect offsets. For example:
|
||||
|
||||
@smallexample
|
||||
struct A @{@};
|
||||
|
||||
struct B @{
|
||||
A a;
|
||||
virtual void f ();
|
||||
@};
|
||||
|
||||
struct C : public B, public A @{@};
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
G++ places the @code{A} base class of @code{C} at a nonzero offset;
|
||||
it should be placed at offset zero. G++ mistakenly believes that the
|
||||
@code{A} data member of @code{B} is already at offset zero.
|
||||
|
||||
@item
|
||||
Names of template functions whose types involve @code{typename} or
|
||||
template template parameters can be mangled incorrectly.
|
||||
|
||||
@smallexample
|
||||
template <typename Q>
|
||||
void f(typename Q::X) @{@}
|
||||
|
||||
template <template <typename> class Q>
|
||||
void f(typename Q<int>::X) @{@}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Instantiations of these templates may be mangled incorrectly.
|
||||
|
||||
@end itemize
|
||||
|
||||
It also warns about psABI-related changes. The known psABI changes at this
|
||||
point include:
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
/* { dg-warning "incompatible" } */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fstrict-volatile-bitfields -fabi-version=1" } */
|
|
@ -1,5 +0,0 @@
|
|||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
struct S { // { dg-warning "ABI" }
|
||||
char c : 1024; // { dg-warning "width" }
|
||||
};
|
|
@ -1,15 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
// { dg-options "-Wabi -fabi-version=1 -mno-ms-bitfields" { target i?86-*-* x86_64-*-* } }
|
||||
|
||||
struct A {
|
||||
virtual void f();
|
||||
int f1 : 1;
|
||||
};
|
||||
|
||||
struct B : public A {
|
||||
int f2 : 1; // { dg-warning "ABI" }
|
||||
int : 0;
|
||||
int f3 : 4;
|
||||
int f4 : 3;
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
union U { // { dg-warning "ABI" }
|
||||
int i: 4096; // { dg-warning "exceeds" }
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// { dg-options "-fabi-version=1" }
|
||||
|
||||
void *operator new[](__SIZE_TYPE__, void *);
|
||||
|
||||
struct A {
|
||||
~A(){}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
A * a = (A*) new char[20];
|
||||
A * b = new(a) A[3];
|
||||
// In the 3.2 ABI, a cookie was allocated in this case.
|
||||
if (a == b)
|
||||
return 1;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
struct A {
|
||||
virtual void a ();
|
||||
};
|
||||
|
||||
struct B {
|
||||
virtual ~B ();
|
||||
};
|
||||
|
||||
struct C : public A, public B { // { dg-warning "virtual" }
|
||||
virtual void c ();
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
struct A {};
|
||||
|
||||
struct B {
|
||||
A a; // { dg-warning "empty" "" { xfail mmix-*-* } }
|
||||
virtual void f () {}
|
||||
} __attribute__((aligned(2 * sizeof (void *))));
|
||||
/* The preceding attribute is necessary on targets with
|
||||
BIGGEST_ALIGNMENT <= POINTER_SIZE to trigger the warning, as
|
||||
otherwise the offset of 'a' (i.e. POINTER_SIZE) is split into a
|
||||
non-zero DECL_FIELD_OFFSET and a zero DECL_FIELD_BIT_OFFSET,
|
||||
and then there is no discrepancy between DECL_FIELD_OFFSET and
|
||||
byte_position to warn about. */
|
|
@ -1,5 +0,0 @@
|
|||
// { dg-options "-fabi-version=1" }
|
||||
|
||||
#if __GXX_ABI_VERSION != 102
|
||||
#error "Incorrect value of __GXX_ABI_VERSION"
|
||||
#endif
|
|
@ -1,10 +0,0 @@
|
|||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
template <typename Q>
|
||||
void f (typename Q::X) {} // { dg-warning "mangle" }
|
||||
|
||||
struct S {
|
||||
typedef int X;
|
||||
};
|
||||
|
||||
template void f<S> (int); // { dg-message "required" }
|
|
@ -1,11 +0,0 @@
|
|||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
template <template <typename> class Q>
|
||||
void f (typename Q<int>::X) {} // { dg-warning "mangle" }
|
||||
|
||||
template <typename Q>
|
||||
struct S {
|
||||
typedef int X;
|
||||
};
|
||||
|
||||
template void f<S> (int); // { dg-message "required" }
|
|
@ -1,13 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
// { dg-final { scan-assembler "_Z1g1SIXadsr1ANS0_1fIiEEivEE" } }
|
||||
|
||||
struct A {
|
||||
template <typename T> int f ();
|
||||
};
|
||||
|
||||
typedef int (A::*P)();
|
||||
|
||||
template <P> struct S {};
|
||||
|
||||
void g (S<&A::f<int> >) {} // { dg-warning "mangle" }
|
|
@ -1,11 +0,0 @@
|
|||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
enum E { e = 3 };
|
||||
|
||||
template <int I> struct S {};
|
||||
|
||||
template <int I> void f (S<I + e + int (3.7)>) {} // { dg-warning "mangle" }
|
||||
template void f<7>(S<7 + e + int (3.7)>); // { dg-message "required" }
|
||||
|
||||
template <int I> void g (S<I + e + int (3.7)>) {} // { dg-warning "mangle" }
|
||||
template void g<7>(S<7 + e + int (3.7)>); // { dg-message "required" }
|
|
@ -1,23 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-fabi-version=1 -Wabi" }
|
||||
|
||||
// Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 30 Nov 2003 <nathan@codesourcery.com>
|
||||
|
||||
// PR 13241
|
||||
// mangled template arguments that are external objects incorrectly
|
||||
|
||||
extern "C" void Foo ();
|
||||
namespace NMS
|
||||
{
|
||||
extern "C" int V;
|
||||
}
|
||||
|
||||
template <void (*)()> struct S {};
|
||||
template <int *> struct T {};
|
||||
|
||||
void f (S<Foo>){} // { dg-warning "mangled name" }
|
||||
// { dg-final { scan-assembler "\n_?_Z1f1SIXadL3FooEEE\[: \t\n\]" } }
|
||||
|
||||
void g (T<&NMS::V>){} // { dg-warning "mangled name" }
|
||||
// { dg-final { scan-assembler "\n_?_Z1g1TIXadL_ZN3NMS1VEEEE\[: \t\n\]" } }
|
|
@ -1,13 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-fabi-version=1 -Wabi" }
|
||||
|
||||
// Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
|
||||
|
||||
// PR 13242
|
||||
// mangled template arguments that are external objects incorrectly
|
||||
|
||||
extern int N;
|
||||
template <int &> struct S {};
|
||||
void n (S<N>) {} // { dg-warning "mangled name" }
|
||||
// { dg-final { scan-assembler "\n_?_Z1n1SIXadL_Z1NEEE\[: \t\n\]" } }
|
|
@ -1,16 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-fabi-version=1 -Wabi" }
|
||||
|
||||
// Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
|
||||
|
||||
// PR 9043
|
||||
// mangled array types in templates
|
||||
|
||||
template <int I> void f(int (*)[2]) {} // { dg-warning "mangled name" }
|
||||
template <int I> void g(int (*)[I+2]) {}
|
||||
|
||||
template void f<1>(int (*)[2]); // { dg-message "required" }
|
||||
// { dg-final { scan-assembler "\n_?_Z1fILi1EEvPALi2E_i\[: \t\n\]" } }
|
||||
template void g<1>(int (*)[3]);
|
||||
// { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } }
|
|
@ -1,14 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// -fpack-struct is necessary because the code below assumes the initial
|
||||
// packing is larger than 1, which cannot ge guaranteed for all targets.
|
||||
// { dg-options "-Wabi -fabi-version=1 -fpack-struct=8" }
|
||||
// On ARM processors, the alignment of B will be 4 even though it
|
||||
// contains only a single "char". That would avoids the situation
|
||||
// that the warning below is designed to catch. We therefore
|
||||
// explicitly set the default structure alignment to 1.
|
||||
// { dg-options "-Wabi -fabi-version=1 -mstructure-size-boundary=8" { target arm*-*-* } }
|
||||
|
||||
struct A { virtual void f(); char c1; };
|
||||
struct B { B(); char c2; };
|
||||
struct C : public A, public virtual B {}; // { dg-warning "ABI" }
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
// { dg-options "-Wabi -fabi-version=1" }
|
||||
|
||||
struct E1 {};
|
||||
struct E2 : public E1 {}; // { dg-warning "layout" }
|
||||
struct E : public E1, public E2 {}; // { dg-warning "layout|ambiguity" }
|
||||
struct N : public E { virtual void f () {} }; // { dg-warning "nearly" }
|
|
@ -1,17 +0,0 @@
|
|||
// PR c++/47301
|
||||
// { dg-do compile { target c++11 } }
|
||||
// { dg-options "-fabi-version=1" }
|
||||
|
||||
struct A
|
||||
{
|
||||
constexpr operator int ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
template < int > struct B
|
||||
{
|
||||
static constexpr A a = A();
|
||||
int ar[a];
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
// PR c++/47303
|
||||
// { dg-do compile }
|
||||
// { dg-options "-fabi-version=1" }
|
||||
|
||||
|
||||
struct Z
|
||||
{
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-fabi-version=1" }
|
||||
|
||||
// Contributed by Nathan Sidwell 22 Dec 2003 <nathan@codesourcery.com>
|
||||
// Origin: Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
// PR c++/12774 Array domains compared unequal
|
||||
|
||||
void Foo(double r[3][3])
|
||||
{
|
||||
}
|
||||
|
||||
void Baz()
|
||||
{
|
||||
double m[3][3];
|
||||
Foo(m);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Bar()
|
||||
{
|
||||
double m[3][3];
|
||||
Foo(m);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Baz();
|
||||
Bar<int>();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-fabi-version=1" }
|
||||
|
||||
// Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
|
||||
|
||||
// PR c++/13494. ICE
|
||||
|
||||
template<typename T>
|
||||
int foo(int d[][4])
|
||||
{
|
||||
return d[0][0];
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// { dg-options "-fabi-version=1 -Wno-abi" }
|
||||
|
||||
template <typename T> struct S {
|
||||
struct I{};
|
||||
operator I* ();
|
||||
};
|
||||
|
||||
template <typename T> struct S2 : S<T> {
|
||||
operator typename S<T>::I* ();
|
||||
};
|
||||
|
||||
template struct S2<int>;
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (C) 2001 Free Software Foundation
|
||||
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
// { dg-do compile }
|
||||
// { dg-options "-fno-inline -fabi-version=1 -Wno-abi" }
|
||||
// { dg-options "-fno-inline" }
|
||||
|
||||
struct A
|
||||
{
|
||||
|
@ -22,4 +22,4 @@ int main()
|
|||
f<A>(x);
|
||||
}
|
||||
|
||||
// { dg-final { scan-assembler "\n_?_Z1fI1AEv1XIN1T1BEE\[: \t\n\]" } }
|
||||
// { dg-final { scan-assembler "\n_?_Z1fI1AEv1XINT_1BEE\[: \t\n\]" } }
|
||||
|
|
|
@ -1290,11 +1290,11 @@ process_options (void)
|
|||
flag_ira_region
|
||||
= optimize_size || !optimize ? IRA_REGION_ONE : IRA_REGION_MIXED;
|
||||
|
||||
if (flag_strict_volatile_bitfields > 0 && !abi_version_at_least (2))
|
||||
if (!abi_version_at_least (2))
|
||||
{
|
||||
warning (0, "-fstrict-volatile-bitfields disabled; "
|
||||
"it is incompatible with ABI versions < 2");
|
||||
flag_strict_volatile_bitfields = 0;
|
||||
/* -fabi-version=1 support was removed after GCC 4.9. */
|
||||
error ("%<-fabi-version=1%> is no longer supported");
|
||||
flag_abi_version = 2;
|
||||
}
|
||||
|
||||
/* Unrolling all loops implies that standard loop unrolling must also
|
||||
|
|
Loading…
Reference in New Issue