This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Small fix for assigning values to vectors


Ken Werner wrote:

> As can be seen the GDB behaves incorrect for vector types. A quick look to the 
> valops.c:value_assign function shows that value_coerce_to_target creates a 
> value with lval set to lval_memory for array types (including vectors). The 
> code was introduced with the following patch: http://sourceware.org/ml/gdb-
> patches/2008-03/msg00079.html. I have to admit that I do not entirely 
> understand why value_coerce_to_target is called here.

Dan, do you recall why you added a value_coerce_to_target for the *destination*
of an assignment?  It seems this shouldn't really be necessary ...

> @@ -1424,6 +1424,9 @@ value_must_coerce_to_target (struct valu
>  
>    valtype = check_typedef (value_type (val));
>  
> +  if (TYPE_VECTOR (valtype))
> +    return 0;
> +
>    switch (TYPE_CODE (valtype))
>      {
>      case TYPE_CODE_ARRAY:

Ken, this doesn't look quite right: the TYPE_VECTOR flag is defined only for
TYPE_CODE_ARRAY types; you should never look at TYPE_VECTOR for any other type.

Otherwise, this looks reasonable to me ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]