diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-04 22:51:42 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-04 22:51:42 +0000 |
commit | 92552a26b31e9d7d857794cf1271c3b6a9e064b1 (patch) | |
tree | aec6f99c441c9265e6586e4694d0aa72c7570eaa /gcc/cp/cp-objcp-common.c | |
parent | a62d86ae7e685296bbac99149180e2a333e7f2c5 (diff) | |
download | gcc-92552a26b31e9d7d857794cf1271c3b6a9e064b1.tar.gz |
* cp-objcp-common.c (cp_expr_size): Return NULL in the case
size is undefined.
* builtins.c (fold_builtin_memory_op): Check that expr_size match.
* explow.c (expr_size, int_expr_size): Assert that size is non_NULL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119515 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cp-objcp-common.c')
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index a3e19db244f..a3640876c1d 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -82,29 +82,29 @@ cp_expr_size (tree exp) /* 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. */ |