diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2002-10-15 16:01:02 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2002-10-15 16:01:02 +0000 |
commit | 6742d92b7f8742b0ac8bc860d5ed4e809a2f901b (patch) | |
tree | 7e2dd26404c44cb9b3f4ad7db5d3abb4793d1ae9 /gcc/cp/init.c | |
parent | c034672ab8165e27126122152c638217bfd57974 (diff) | |
download | gcc-6742d92b7f8742b0ac8bc860d5ed4e809a2f901b.zip gcc-6742d92b7f8742b0ac8bc860d5ed4e809a2f901b.tar.gz gcc-6742d92b7f8742b0ac8bc860d5ed4e809a2f901b.tar.bz2 |
init.c (build_delete): Do not apply save_expr for arrays.
cp:
* init.c (build_delete): Do not apply save_expr for arrays.
(build_vec_delete): Likewise.
testsuite:
* g++.dg/init/ctor1.C: New test.
From-SVN: r58166
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 0fefc12..3e71e9f 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3099,8 +3099,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete) else if (TREE_CODE (type) == ARRAY_TYPE) { handle_array: - if (TREE_SIDE_EFFECTS (addr)) - addr = save_expr (addr); + if (TYPE_DOMAIN (type) == NULL_TREE) { error ("unknown array size in delete"); @@ -3342,15 +3341,13 @@ build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete) base = stabilize_reference (base); - /* Since we can use base many times, save_expr it. */ - if (TREE_SIDE_EFFECTS (base)) - base = save_expr (base); - if (TREE_CODE (type) == POINTER_TYPE) { /* Step back one from start of vector, and read dimension. */ tree cookie_addr; + if (TREE_SIDE_EFFECTS (base)) + base = save_expr (base); type = strip_array_types (TREE_TYPE (type)); cookie_addr = build (MINUS_EXPR, build_pointer_type (sizetype), @@ -3364,6 +3361,8 @@ build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete) maxindex = array_type_nelts_total (type); type = strip_array_types (type); base = build_unary_op (ADDR_EXPR, base, 1); + if (TREE_SIDE_EFFECTS (base)) + base = save_expr (base); } else { |