diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-10-30 23:40:13 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-10-30 23:40:13 +0100 |
commit | 33a49c17e8437b2405616dbd4294a59cd339b880 (patch) | |
tree | e513c43598d7397ff47b6939f966833088e4837a /gcc/fold-const.c | |
parent | 4c38e99eb4137eab7acfed72c434d8667051372e (diff) | |
download | gcc-33a49c17e8437b2405616dbd4294a59cd339b880.zip gcc-33a49c17e8437b2405616dbd4294a59cd339b880.tar.gz gcc-33a49c17e8437b2405616dbd4294a59cd339b880.tar.bz2 |
re PR c++/33709 (Type verification failure with new expression)
PR c++/33709
* fold-const.c (fold_binary): If one argument is COMPOUND_EXPR,
convert second operand of COMPOUND_EXPR to the original type of
that argument.
* g++.dg/opt/compound1.C: New test.
From-SVN: r129785
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fd5a708..2598ec1 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9504,12 +9504,15 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) if (TREE_CODE (arg0) == COMPOUND_EXPR) return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0), fold_build2 (code, type, - TREE_OPERAND (arg0, 1), op1)); + fold_convert (TREE_TYPE (op0), + TREE_OPERAND (arg0, 1)), + op1)); if (TREE_CODE (arg1) == COMPOUND_EXPR && reorder_operands_p (arg0, TREE_OPERAND (arg1, 0))) return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0), - fold_build2 (code, type, - op0, TREE_OPERAND (arg1, 1))); + fold_build2 (code, type, op0, + fold_convert (TREE_TYPE (op1), + TREE_OPERAND (arg1, 1)))); if (TREE_CODE (arg0) == COND_EXPR || COMPARISON_CLASS_P (arg0)) { |