X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fvalops.c;h=b9bc460fa673ac38b57194f76c684e01a2284f3b;hb=8954db33ac73962ac337cc456a782db7e9539c06;hp=e3d36a12ca95ee530f4751eb07f4e2fefb2d8806;hpb=d79dcc73ac46dad924acf843a2c3546517506f9e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/valops.c b/gdb/valops.c index e3d36a12ca..b9bc460fa6 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -546,29 +546,13 @@ value_cast (struct type *type, struct value *arg2) minus one, instead of biasing the normal case. */ return value_from_longest (type, -1); } - else if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && scalar) - { - /* Widen the scalar to a vector. */ - struct type *eltype; - struct value *val; - LONGEST low_bound, high_bound; - int i; - - if (!get_array_bounds (type, &low_bound, &high_bound)) - error (_("Could not determine the vector bounds")); - - eltype = check_typedef (TYPE_TARGET_TYPE (type)); - arg2 = value_cast (eltype, arg2); - val = allocate_value (type); - - for (i = 0; i < high_bound - low_bound + 1; i++) - { - /* Duplicate the contents of arg2 into the destination vector. */ - memcpy (value_contents_writeable (val) + (i * TYPE_LENGTH (eltype)), - value_contents_all (arg2), TYPE_LENGTH (eltype)); - } - return val; - } + else if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + && code2 == TYPE_CODE_ARRAY && TYPE_VECTOR (type2) + && TYPE_LENGTH (type) != TYPE_LENGTH (type2)) + error (_("Cannot convert between vector values of different sizes")); + else if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && scalar + && TYPE_LENGTH (type) != TYPE_LENGTH (type2)) + error (_("can only cast scalar to vector of same size")); else if (code1 == TYPE_CODE_VOID) { return value_zero (type, not_lval);