Fix special-case-bug for vectors in UnaryExpr.

In some cases one can get the Type() of unaryexpr to be ANY. Vectors so
far did not deal gracefully with this and crashed because trying to
convert any to a vectortype.

This patch fixes this by just using the original vector-type in this
case.
This commit is contained in:
Johanna Amann 2018-07-20 13:36:38 -07:00
parent da58f9d4a6
commit 12add53131
2 changed files with 26 additions and 1 deletions

View file

@ -456,7 +456,13 @@ Val* UnaryExpr::Eval(Frame* f) const
if ( is_vector(v) )
{
VectorVal* v_op = v->AsVectorVal();
VectorVal* result = new VectorVal(Type()->AsVectorType());
VectorType* out_t;
if ( Type()->Tag() == TYPE_ANY )
out_t = v->Type()->AsVectorType();
else
out_t = Type()->AsVectorType();
VectorVal* result = new VectorVal(out_t);
for ( unsigned int i = 0; i < v_op->Size(); ++i )
{