aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-07-07 21:41:55 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-07-07 21:41:55 +0200
commite834d8486a88ee5664c0c2e17b4c2dbd811c0c65 (patch)
treea9beb78a1647efd76c07e82f4a3098a474d6a4a5 /gcc/cp
parentc4603e7ce0b0e007db25abc234a85d1562a9c988 (diff)
downloadgcc-e834d8486a88ee5664c0c2e17b4c2dbd811c0c65.zip
gcc-e834d8486a88ee5664c0c2e17b4c2dbd811c0c65.tar.gz
gcc-e834d8486a88ee5664c0c2e17b4c2dbd811c0c65.tar.bz2
re PR c/49644 (post-increment of promoted operand is incorrect.)
PR c/49644 * typeck.c (cp_build_binary_op): For MULT_EXPR and TRUNC_DIV_EXPR with one non-complex and one complex argument, call save_expr on both operands. * g++.dg/torture/pr49644.C: New test. From-SVN: r176006
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/typeck.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3957d5a..c5c83d0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/49644
+ * typeck.c (cp_build_binary_op): For MULT_EXPR and TRUNC_DIV_EXPR with
+ one non-complex and one complex argument, call save_expr on both
+ operands.
+
2011-07-06 Jason Merrill <jason@redhat.com>
PR c++/49353
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7af76b1..2acb18e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4338,6 +4338,7 @@ cp_build_binary_op (location_t location,
{
case MULT_EXPR:
case TRUNC_DIV_EXPR:
+ op1 = save_expr (op1);
imag = build2 (resultcode, real_type, imag, op1);
/* Fall through. */
case PLUS_EXPR:
@@ -4356,6 +4357,7 @@ cp_build_binary_op (location_t location,
switch (code)
{
case MULT_EXPR:
+ op0 = save_expr (op0);
imag = build2 (resultcode, real_type, op0, imag);
/* Fall through. */
case PLUS_EXPR: