[PATCH 10/11] ELFv2 ABI: structure passing / return

Ulrich Weigand Ulrich.Weigand@de.ibm.com
Fri Jan 31 15:41:00 GMT 2014


Joel Brobecker <brobecker@adacore.com> wrote on 31.01.2014 11:09:46:

> That is indeed a good explanation. I suggest we re-use your explanation,
> or at least the second part of it, to explain why n_elts is an int
> and why the cast of field_count down to int is safe. You'll avoid
> someone like me, who is tuned to treat all casts as suspicious, from
> unmaking your choice :-).

OK, makes sense.  I've added the following comment:

              /* Note that field_count is LONGEST since it may hold the
size
                 of an array, while *n_elts is int since its value is
bounded
                 by the number of registers used for argument passing.  The
                 cast cannot overflow due to the bounds checking above.  */

Bye,
Ulrich



More information about the Gdb-patches mailing list