Commit bdaa131b by Jason Merrill Committed by Jason Merrill

re PR c++/10091 ([parisc] ICE in cp_expr_size, at cp/cp-lang.c:307)

        PR c++/10091
        * expr.c (expand_expr) [ADDR_EXPR]: Disallow taking the address of
        an unaligned member of TREE_ADDRESSABLE type.
        * cp/typeck.c (build_class_member_access_expr): Compare
        TYPE_MAIN_VARIANTs.

From-SVN: r64520
parent ffcfcb5f
2003-03-17 Jason Merrill <jason@redhat.com>
PR c++/10091
* expr.c (expand_expr) [ADDR_EXPR]: Disallow taking the address of
an unaligned member of TREE_ADDRESSABLE type.
2003-03-18 Alan Modra <amodra@bigpond.net.au> 2003-03-18 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/linux64.h (MASK_PROFILE_KERNEL): Define. * config/rs6000/linux64.h (MASK_PROFILE_KERNEL): Define.
......
2003-03-17 Jason Merrill <jason@redhat.com>
PR c++/10091
* typeck.c (build_class_member_access_expr): Compare
TYPE_MAIN_VARIANTs.
2003-03-17 Mark Mitchell <mark@codesourcery.com> 2003-03-17 Mark Mitchell <mark@codesourcery.com>
PR c++/9639 PR c++/9639
......
...@@ -1941,7 +1941,8 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1941,7 +1941,8 @@ build_class_member_access_expr (tree object, tree member,
&& integer_zerop (TREE_OPERAND (object, 0))); && integer_zerop (TREE_OPERAND (object, 0)));
/* Convert OBJECT to the type of MEMBER. */ /* Convert OBJECT to the type of MEMBER. */
if (!same_type_p (object_type, member_scope)) if (!same_type_p (TYPE_MAIN_VARIANT (object_type),
TYPE_MAIN_VARIANT (member_scope)))
{ {
tree binfo; tree binfo;
base_kind kind; base_kind kind;
...@@ -1951,7 +1952,7 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1951,7 +1952,7 @@ build_class_member_access_expr (tree object, tree member,
if (binfo == error_mark_node) if (binfo == error_mark_node)
return error_mark_node; return error_mark_node;
/* It is invalid to use to try to get to a virtual base of a /* It is invalid to try to get to a virtual base of a
NULL object. The most common cause is invalid use of NULL object. The most common cause is invalid use of
offsetof macro. */ offsetof macro. */
if (null_object_p && kind == bk_via_virtual) if (null_object_p && kind == bk_via_virtual)
......
...@@ -9243,8 +9243,19 @@ expand_expr (exp, target, tmode, modifier) ...@@ -9243,8 +9243,19 @@ expand_expr (exp, target, tmode, modifier)
&& MEM_ALIGN (op0) < BIGGEST_ALIGNMENT) && MEM_ALIGN (op0) < BIGGEST_ALIGNMENT)
{ {
tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0)); tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
rtx new rtx new;
= assign_stack_temp_for_type
if (TYPE_ALIGN_OK (inner_type))
abort ();
if (TREE_ADDRESSABLE (inner_type))
{
/* We can't make a bitwise copy of this object, so fail. */
error ("cannot take the address of an unaligned member");
return const0_rtx;
}
new = assign_stack_temp_for_type
(TYPE_MODE (inner_type), (TYPE_MODE (inner_type),
MEM_SIZE (op0) ? INTVAL (MEM_SIZE (op0)) MEM_SIZE (op0) ? INTVAL (MEM_SIZE (op0))
: int_size_in_bytes (inner_type), : int_size_in_bytes (inner_type),
...@@ -9252,12 +9263,10 @@ expand_expr (exp, target, tmode, modifier) ...@@ -9252,12 +9263,10 @@ expand_expr (exp, target, tmode, modifier)
(TYPE_QUALS (inner_type) (TYPE_QUALS (inner_type)
| TYPE_QUAL_CONST))); | TYPE_QUAL_CONST)));
if (TYPE_ALIGN_OK (inner_type))
abort ();
emit_block_move (new, op0, expr_size (TREE_OPERAND (exp, 0)), emit_block_move (new, op0, expr_size (TREE_OPERAND (exp, 0)),
(modifier == EXPAND_STACK_PARM (modifier == EXPAND_STACK_PARM
? BLOCK_OP_CALL_PARM : BLOCK_OP_NORMAL)); ? BLOCK_OP_CALL_PARM : BLOCK_OP_NORMAL));
op0 = new; op0 = new;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment