summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-10-14 23:57:44 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-10-14 23:57:44 +0200
commitd767aebf70b16d6e99742df6fa9f8b90ffb77c29 (patch)
tree7bdec745adc124103749a3698e515fadf23a280d /gcc/cp
parent5c0a2e3ac5db71c75bea10d3f7d729c625da1eac (diff)
downloadgcc-d767aebf70b16d6e99742df6fa9f8b90ffb77c29.tar.gz
re PR c++/37819 (ice for bitfield code)
PR c++/37819 * cp-gimplify.c (cp_genericize_r): Only fold_convert COND_EXPR arguments if they don't already have COND_EXPR's type. * g++.dg/expr/bitfield11.C: New test. From-SVN: r141118
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-gimplify.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 73a1656522d..30110cca72c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/37819
+ * cp-gimplify.c (cp_genericize_r): Only fold_convert COND_EXPR
+ arguments if they don't already have COND_EXPR's type.
+
2008-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37650
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 1641be5ebdc..144de3f1ecd 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -815,14 +815,18 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
= (TREE_OPERAND (stmt, 2)
? is_bitfield_expr_with_lowered_type (TREE_OPERAND (stmt, 2))
: NULL_TREE);
- if (type_left)
+ if (type_left
+ && !useless_type_conversion_p (TREE_TYPE (stmt),
+ TREE_TYPE (TREE_OPERAND (stmt, 1))))
{
TREE_OPERAND (stmt, 1)
= fold_convert (type_left, TREE_OPERAND (stmt, 1));
gcc_assert (useless_type_conversion_p (TREE_TYPE (stmt),
type_left));
}
- if (type_right)
+ if (type_right
+ && !useless_type_conversion_p (TREE_TYPE (stmt),
+ TREE_TYPE (TREE_OPERAND (stmt, 2))))
{
TREE_OPERAND (stmt, 2)
= fold_convert (type_right, TREE_OPERAND (stmt, 2));