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: Memory corruption for host double format different from target double format


On Friday, August 10, 2012 11:32:53 AM Thomas Schwinge wrote:
> gdbarch.c:verify_gdbarch:
> 
>     [...]
>       /* Skip verify of float_bit, invalid_p == 0 */
>       if (gdbarch->float_format == 0)
>         gdbarch->float_format = floatformats_ieee_single;
>       /* Skip verify of double_bit, invalid_p == 0 */
>       if (gdbarch->double_format == 0)
>         gdbarch->double_format = floatformats_ieee_double;
>       /* Skip verify of long_double_bit, invalid_p == 0 */
>       if (gdbarch->long_double_format == 0)
>         gdbarch->long_double_format = floatformats_ieee_double;
>     [...]
> 
> That is, if set_gdbarch_double_format has not been called, it will
> default to floatformats_ieee_double -- even though set_gdbarch_double_bit
> may have been called setting it unequal to the 64-bit double format.
> Hmm, and gdbarch.c:verify_gdbarch has the following comment on top of it:
> ÂEnsure that all values in a GDBARCH are reasonable.  ;-)

Looks like some checking like this is missing?

  gdbarch->float_format->totalsize <= gdbarch->float_bit
  gdbarch->double_format->totalsize <= gdbarch->double_bit

-- 
Yao (éå)


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