ARM EABI: GDB internal error on printing out float (VFP math)

Sergei Poselenov
2008-11-13T14:35:03Z

Hello all,

I've ran into this running the GDB testsuite, store.exp.

-bash-3.2# gdb store
GNU gdb Red Hat Linux (6.7-1rh)
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "arm-linux"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b wack_float
Breakpoint 1 at 0x837c: file /opt/eldk42armFP/armFP/tmp/store.c, line 11.
(gdb) r
Starting program: /tmp/store

Breakpoint 1, wack_float (u=-1, v=-2) at
/opt/eldk42armFP/armFP/tmp/store.c:11
11 register float l = u, r = v;
(gdb) n
12 l = add_float (l, r);
(gdb) p r
../../gdb/regcache.c:178: internal-error: register_size: Assertion
`regnum >= 0 && regnum < (gdbarch_num_regs (current_gdbarch) +
gdbarch_num_pseudo_regs (current_gdbarch))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

Here is the reduced testcase:
float
add_float (register float u, register float v)
{
return u + v;
}

float
wack_float (register float u, register float v)
{
register float l = u, r = v;
l = add_float (l, r);
return l + r;
}

int
main ()
{
wack_float (-1, -2);
return 0;
}

The test was built as follows:
arm-linux-gcc -o store -g store.c -mfpu=vfp -mfloat-abi=softfp

arm-linux-gcc -v
Reading specs from
/opt/eldk-4.2-arm-2008-10-21/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/specs
Target: arm-linux-gnueabi
Configured with:
/work/psl/eldk-builds/arm-2008-10-21/work/usr/src/denx/BUILD/crosstool-0.43/build/gcc-4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueabi/gcc-4.2.2/configure
--target=arm-linux-gnueabi --host=i686-host_pc-linux-gnu
--prefix=/var/tmp/eldk.F0dvjm/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueabi
--disable-hosted-libstdcxx
--with-headers=/var/tmp/eldk.F0dvjm/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueabi/arm-linux-gnueabi/include
--with-local-prefix=/var/tmp/eldk.F0dvjm/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueabi/arm-linux-gnueabi
--disable-nls --enable-threads=posix --enable-symvers=gnu
--enable-__cxa_atexit --enable-languages=c,c++,java --enable-shared
--enable-c99 --enable-long-long --without-x
Thread model: posix
gcc version 4.2.2

The problem reproduced with GDB 6.8-release, as well.

Thanks for any help,
Sergei