diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-11-21 10:41:27 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2006-11-21 10:41:27 +0100 |
commit | 4576ceaf227bb48e2771f388405e3043b5e4ffeb (patch) | |
tree | dfda9b44bba52234a55d6932d2b7e09d01cdb2bb /gcc/cp/cvt.c | |
parent | b509487e8855a198e2fd7b40316b6d124ef3afc4 (diff) | |
download | gcc-4576ceaf227bb48e2771f388405e3043b5e4ffeb.zip gcc-4576ceaf227bb48e2771f388405e3043b5e4ffeb.tar.gz gcc-4576ceaf227bb48e2771f388405e3043b5e4ffeb.tar.bz2 |
re PR c++/29734 (ICE with vector in switch condition)
PR c++/29734
* cp-tree.h (WANT_VECTOR): Define.
(WANT_ARITH): Add WANT_VECTOR.
* cvt.c (build_expr_type_conversion): Handle vector types.
* typeck.c (build_unary_op): Add WANT_VECTOR to
build_expr_type_conversion flags.
* g++.dg/conversion/simd4.C: New test.
From-SVN: r119044
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 6f61218..f09f708 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1103,7 +1103,6 @@ build_expr_type_conversion (int desires, tree expr, bool complain) return expr; /* else fall through... */ - case VECTOR_TYPE: case BOOLEAN_TYPE: return (desires & WANT_INT) ? expr : NULL_TREE; case ENUMERAL_TYPE: @@ -1117,6 +1116,23 @@ build_expr_type_conversion (int desires, tree expr, bool complain) case ARRAY_TYPE: return (desires & WANT_POINTER) ? decay_conversion (expr) : NULL_TREE; + + case VECTOR_TYPE: + if ((desires & WANT_VECTOR) == 0) + return NULL_TREE; + switch (TREE_CODE (TREE_TYPE (basetype))) + { + case INTEGER_TYPE: + case BOOLEAN_TYPE: + return (desires & WANT_INT) ? expr : NULL_TREE; + case ENUMERAL_TYPE: + return (desires & WANT_ENUM) ? expr : NULL_TREE; + case REAL_TYPE: + return (desires & WANT_FLOAT) ? expr : NULL_TREE; + default: + return NULL_TREE; + } + default: return NULL_TREE; } @@ -1151,6 +1167,23 @@ build_expr_type_conversion (int desires, tree expr, bool complain) case POINTER_TYPE: win = (desires & WANT_POINTER); break; + case VECTOR_TYPE: + if ((desires & WANT_VECTOR) == 0) + break; + switch (TREE_CODE (TREE_TYPE (candidate))) + { + case BOOLEAN_TYPE: + case INTEGER_TYPE: + win = (desires & WANT_INT); break; + case ENUMERAL_TYPE: + win = (desires & WANT_ENUM); break; + case REAL_TYPE: + win = (desires & WANT_FLOAT); break; + default: + break; + } + break; + default: break; } |