While looking at a bug, I noticed what I think is an off-by-one
mistake in a call to vector::reserve. This code:
new_args.reserve (args.size ());
new_args.push_back
(value_from_pointer (lookup_pointer_type (values_type), struct_addr));
new_args.insert (new_args.end (), args.begin (), args.end ());
... reserves 'size()' entries, but then proceeds to push one extra
one.
This shouldn't have any really bad effects, as insert will grow the
vector. Still, it seems better to use the correct size if we're going
to bother calling reserve.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30780
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
if (return_method == return_method_hidden_param)
{
/* Add the new argument to the front of the argument list. */
- new_args.reserve (args.size ());
+ new_args.reserve (1 + args.size ());
new_args.push_back
(value_from_pointer (lookup_pointer_type (values_type), struct_addr));
new_args.insert (new_args.end (), args.begin (), args.end ());