From a87db577fbb1b87486527c98b44727991ee998b4 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Mon, 28 May 2007 17:25:25 -0700 Subject: [PATCH] [multiple changes] 2007-05-28 Andrew Pinski PR c/31339 * c-typeck.c (build_unary_op ): Return the error_mark_node if either the real or imaginary parts would an error_mark_node. 2007-05-28 Andrew Pinski PR c++/31339 * typeck.c (build_unary_op ): Return the error_mark_node if either the real or imaginary parts would an error_mark_node. 2007-05-28 Andrew Pinski PR c/31339 * gcc.dg/boolcomplex-1.c: New test. PR c++/31339 * g++.dg/ext/boolcomplex-1.c: New test From-SVN: r125156 --- gcc/ChangeLog | 9 +++++++++ gcc/c-typeck.c | 5 ++++- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/typeck.c | 5 ++++- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/ext/boolcomplex-1.c | 3 +++ gcc/testsuite/gcc.dg/boolcomplex-1.c | 3 +++ 7 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/boolcomplex-1.c create mode 100644 gcc/testsuite/gcc.dg/boolcomplex-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bcdd44b..1ca6334 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2007-05-28 Andrew Pinski + + PR c/31339 + * c-typeck.c (build_unary_op ): Return the error_mark_node + if either the real or imaginary parts would an + error_mark_node. + 2007-05-28 Daniel Berlin * tree-ssa-dce.c (eliminate_unnecessary_stmts): Release LHS SSA diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index dccf922..a4eed3f 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2908,8 +2908,11 @@ build_unary_op (enum tree_code code, tree xarg, int flag) arg = stabilize_reference (arg); real = build_unary_op (REALPART_EXPR, arg, 1); imag = build_unary_op (IMAGPART_EXPR, arg, 1); + real = build_unary_op (code, real, 1); + if (real == error_mark_node || imag == error_mark_node) + return error_mark_node; return build2 (COMPLEX_EXPR, TREE_TYPE (arg), - build_unary_op (code, real, 1), imag); + real, imag); } /* Report invalid types. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b4d88c..9dca96a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2007-05-28 Andrew Pinski + + PR c++/31339 + * typeck.c (build_unary_op ): Return the error_mark_node + if either the real or imaginary parts would an + error_mark_node. + 2007-05-25 Simon Martin Manuel Lopez-Ibanez diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fa0c956..af21330 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4221,8 +4221,11 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) arg = stabilize_reference (arg); real = build_unary_op (REALPART_EXPR, arg, 1); imag = build_unary_op (IMAGPART_EXPR, arg, 1); + real = build_unary_op (code, real, 1); + if (real == error_mark_node || imag == error_mark_node) + return error_mark_node; return build2 (COMPLEX_EXPR, TREE_TYPE (arg), - build_unary_op (code, real, 1), imag); + real, imag); } /* Report invalid types. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 863a060..6697e0d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2007-05-28 Andrew Pinski + + PR c/31339 + * gcc.dg/boolcomplex-1.c: New test. + + PR c++/31339 + * g++.dg/ext/boolcomplex-1.c: New test. + 2007-05-28 Tobias Burnus PR fortran/32124 diff --git a/gcc/testsuite/g++.dg/ext/boolcomplex-1.c b/gcc/testsuite/g++.dg/ext/boolcomplex-1.c new file mode 100644 index 0000000..d05d9bb --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/boolcomplex-1.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +bool b = --0i == 0; /* { dg-error "lvalue required as decrement operand" } */ diff --git a/gcc/testsuite/gcc.dg/boolcomplex-1.c b/gcc/testsuite/gcc.dg/boolcomplex-1.c new file mode 100644 index 0000000..c34da04 --- /dev/null +++ b/gcc/testsuite/gcc.dg/boolcomplex-1.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +_Bool b = --0i == 0; /* { dg-error "lvalue required as decrement operand" } */ -- 2.7.4