[patch] Small fix for assigning values to vectors

Daniel Jacobowitz dan@codesourcery.com
Wed Jul 7 18:26:00 GMT 2010


On Wed, Jul 07, 2010 at 07:50:14PM +0200, Ulrich Weigand wrote:
> 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 ...

I'm not sure now.  We could try dropping it.

> > @@ -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 ...

It does seem reasonable that a vector does not have to live in target
memory.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list