Bug 7854 - Don't coerce arrays if they're vectors
Summary: Don't coerce arrays if they're vectors
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: exp (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-27 14:28 UTC by ac131313
Modified: 2010-10-24 02:38 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ac131313 2002-09-27 21:28:01 UTC
[Converted from Gnats 749]

MichaelS writes:
Michael Snyder wrote:

> 
> Elena Zannoni wrote:

> >
> > Michael Snyder writes:
> >
> > Which problem does this fix? i.e. which call(s) of value_cast?
> >
> > Elena

> 
> It gets called when I do "print foo(vec_arg)".


Elena, this thread got dropped.  Do you think this change is OK?


> 

> >
> >  >
> >  > This seem reasonable to you vector-savvy folk?
> >  >
> >  > Michael
> >  >
> >  > 2002-05-16  Michael Snyder  <msnyder@redhat.com>
> >  >
> >  >      * valops.c (value_cast): Don't coerce arrays if they're vectors.
> >  >
> >  > Index: valops.c
> >  > ===================================================================
> >  > RCS file: /cvs/src/src/gdb/valops.c,v
> >  > retrieving revision 1.59
> >  > diff -p -r1.59 valops.c
> >  > *** valops.c 13 May 2002 14:00:36 -0000      1.59
> >  > --- valops.c 16 May 2002 22:32:40 -0000
> >  > *************** value_cast (struct type *type, struct va
> >  > *** 210,217 ****
> >  >      }
> >  >       }
> >  >
> >  >     if (current_language->c_style_arrays
> >  > !       && TYPE_CODE (type2) == TYPE_CODE_ARRAY)
> >  >       arg2 = value_coerce_array (arg2);
> >  >
> >  >     if (TYPE_CODE (type2) == TYPE_CODE_FUNC)
> >  > --- 210,221 ----
> >  >      }
> >  >       }
> >  >
> >  > +   /* Arrays are coerced to pointers to their first element, unless
> >  > +      they are vectors, in which case we want to leave them alone,
> >  > +      because they are passed by value.  */
> >  >     if (current_language->c_style_arrays
> >  > !       && TYPE_CODE (type2) == TYPE_CODE_ARRAY
> >  > !       && !TYPE_VECTOR (type2))
> >  >       arg2 = value_coerce_array (arg2);
> >  >
> >  >     if (TYPE_CODE (type2) == TYPE_CODE_FUNC)

Release:
unknown
Comment 1 Tom Tromey 2010-10-24 02:38:35 UTC
I see this patch in CVS.