This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Memory corruption for host double format different from target double format
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, <gdb at sourceware dot org>
- Date: Fri, 10 Aug 2012 18:37:01 +0800
- Subject: Re: Memory corruption for host double format different from target double format
- References: <87r4rgrkss.fsf@schwinge.name> <87ipcrrt16.fsf@schwinge.name>
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 (éå)