+2006-12-04 Jan Hubicka <jh@suse.cz>
+
+ * builtins.c (fold_builtin_memory_op): Check that expr_size match.
+ * explow.c (expr_size, int_expr_size): Assert that size is non_NULL.
+
2006-12-04 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-alias.c (compute_may_aliases):
|| !TYPE_SIZE_UNIT (desttype)
|| TREE_CODE (TYPE_SIZE_UNIT (srctype)) != INTEGER_CST
|| TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST
- || !operand_equal_p (TYPE_SIZE_UNIT (srctype), len, 0)
- || !operand_equal_p (TYPE_SIZE_UNIT (desttype), len, 0))
+ || !tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len)
+ || !tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len))
return 0;
if (get_pointer_alignment (dest, BIGGEST_ALIGNMENT)
srcvar = build_fold_indirect_ref (src);
if (TREE_THIS_VOLATILE (srcvar))
return 0;
+ if (!tree_int_cst_equal (lang_hooks.expr_size (srcvar), len))
+ return 0;
/* With memcpy, it is possible to bypass aliasing rules, so without
this check i. e. execute/20060930-2.c would be misoptimized, because
it use conflicting alias set to hold argument for the memcpy call.
destvar = build_fold_indirect_ref (dest);
if (TREE_THIS_VOLATILE (destvar))
return 0;
+ if (!tree_int_cst_equal (lang_hooks.expr_size (destvar), len))
+ return 0;
if (!var_decl_component_p (destvar))
return 0;
+2006-12-04 Jan Hubicka <jh@suse.cz>
+
+ * cp-objcp-common.c (cp_expr_size): Return NULL in the case
+ size is undefined.
+
2006-12-04 Mark Mitchell <mark@codesourcery.com>
PR c++/29733
/* The backend should not be interested in the size of an expression
of a type with both of these set; all copies of such types must go
through a constructor or assignment op. */
- gcc_assert (!TYPE_HAS_COMPLEX_INIT_REF (type)
- || !TYPE_HAS_COMPLEX_ASSIGN_REF (type)
- /* But storing a CONSTRUCTOR isn't a copy. */
- || TREE_CODE (exp) == CONSTRUCTOR
- /* And, the gimplifier will sometimes make a copy of
- an aggregate. In particular, for a case like:
-
- struct S { S(); };
- struct X { int a; S s; };
- X x = { 0 };
-
- the gimplifier will create a temporary with
- static storage duration, perform static
- initialization of the temporary, and then copy
- the result. Since the "s" subobject is never
- constructed, this is a valid transformation. */
- || CP_AGGREGATE_TYPE_P (type));
-
- /* This would be wrong for a type with virtual bases, but they are
- caught by the assert above. */
- return (is_empty_class (type)
- ? size_zero_node
- : CLASSTYPE_SIZE_UNIT (type));
+ if (!TYPE_HAS_COMPLEX_INIT_REF (type)
+ || !TYPE_HAS_COMPLEX_ASSIGN_REF (type)
+ /* But storing a CONSTRUCTOR isn't a copy. */
+ || TREE_CODE (exp) == CONSTRUCTOR
+ /* And, the gimplifier will sometimes make a copy of
+ an aggregate. In particular, for a case like:
+
+ struct S { S(); };
+ struct X { int a; S s; };
+ X x = { 0 };
+
+ the gimplifier will create a temporary with
+ static storage duration, perform static
+ initialization of the temporary, and then copy
+ the result. Since the "s" subobject is never
+ constructed, this is a valid transformation. */
+ || CP_AGGREGATE_TYPE_P (type))
+ /* This would be wrong for a type with virtual bases. */
+ return (is_empty_class (type)
+ ? size_zero_node
+ : CLASSTYPE_SIZE_UNIT (type));
+ else
+ return NULL_TREE;
}
else
/* Use the default code. */
if (TREE_CODE (exp) == WITH_SIZE_EXPR)
size = TREE_OPERAND (exp, 1);
else
- size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (lang_hooks.expr_size (exp), exp);
+ {
+ size = lang_hooks.expr_size (exp);
+ gcc_assert (size);
+ size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (size, exp);
+ }
return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0);
}
if (TREE_CODE (exp) == WITH_SIZE_EXPR)
size = TREE_OPERAND (exp, 1);
else
- size = lang_hooks.expr_size (exp);
+ {
+ size = lang_hooks.expr_size (exp);
+ gcc_assert (size);
+ }
if (size == 0 || !host_integerp (size, 0))
return -1;