From: John Hedges <john@drystone.co.uk>
To: gdb@sourceware.cygnus.com
Subject: Problem with fld on i686
Date: Fri, 16 Nov 2001 13:40:00 -0000 [thread overview]
Message-ID: <E168dvs-0007FR-00@gwlinux> (raw)
Message-ID: <20011116134000.IYW3SpIUZCIbpMprkRdDQ26LZgSstqw31v3V3BGaHEs@z> (raw)
I've come across what seems to be a debugger problem with fld. The build is
i686 linux pc. The failing code comes from static_cast<double>(float) which
looks ok.:
(gdb) l
138 __ostream_type&
139 operator<<(float __f)
140 { return this->operator<<(static_cast<double>(__f)); }
(gdb) disassemble
0x80aa350 <_ZNSolsEf>: push %ebp
0x80aa351 <_ZNSolsEf+1>: mov %esp,%ebp
0x80aa353 <_ZNSolsEf+3>: sub $0x8,%esp
0x80aa356 <_ZNSolsEf+6>: sub $0x4,%esp
0x80aa359 <_ZNSolsEf+9>: flds 0xc(%ebp)
0x80aa35c <_ZNSolsEf+12>: lea 0xfffffff8(%esp,1),%esp
0x80aa360 <_ZNSolsEf+16>: fstpl (%esp,1)
0x80aa363 <_ZNSolsEf+19>: pushl 0x8(%ebp)
0x80aa366 <_ZNSolsEf+22>: call 0x80abf00 <_ZNSolsEd>
0x80aa36b <_ZNSolsEf+27>: add $0x10,%esp
0x80aa36e <_ZNSolsEf+30>: mov %ebp,%esp
0x80aa370 <_ZNSolsEf+32>: pop %ebp
0x80aa371 <_ZNSolsEf+33>: ret
The contents of ebp+0x0c (0.8) and registers before the flds instruction:
(gdb) x $ebp+12
0xbf1ff790: 0x3f4ccccd
(gdb) info all
eax 0xbf1ff84c -1088423860
ecx 0x0 0
edx 0xbf1ff764 -1088424092
ebx 0x400ea7f0 1074702320
esp 0xbf1ff778 0xbf1ff778
ebp 0xbf1ff784 0xbf1ff784
esi 0x0 0
edi 0x810b0b8 135311544
eip 0x80aa359 0x80aa359
eflags 0x386 902
cs 0x23 35
ss 0x2b 43
ds 0x2b 43
es 0x2b 43
fs 0x0 0
gs 0x0 0
st0 -0e+4922 (raw 0xffff0000000000000000)
st1 -0e+4922 (raw 0xffff0000000000000000)
st2 -0e+4922 (raw 0xffff0000000000000000)
st3 0 (raw 0x00000000000000000000)
st4 1 (raw 0x3fff8000000000000000)
st5 1 (raw 0x3fff8000000000000000)
st6 3 (raw 0x4000c000000000000000)
st7 1.0909090909090909091204782410677865 (raw
0x3fff8ba2e8ba2e8ba2e9)
fctrl 0x37f 895
fstat 0x0 0
ftag 0x0 0
fiseg 0x23 35
fioff 0x401fa178 1075814776
foseg 0x2b 43
fooff 0x4020b648 1075885640
fop 0x0 0
Registers after flds:
(gdb) si
0x080aa35c 140 { return
this->operator<<(static_cast<double>(__f)); }
(gdb) info all
eax 0xbf1ff84c -1088423860
ecx 0x0 0
edx 0xbf1ff764 -1088424092
ebx 0x400ea7f0 1074702320
esp 0xbf1ff778 0xbf1ff778
ebp 0xbf1ff784 0xbf1ff784
esi 0x0 0
edi 0x810b0b8 135311544
eip 0x80aa35c 0x80aa35c
eflags 0x386 902
cs 0x23 35
ss 0x2b 43
ds 0x2b 43
es 0x2b 43
fs 0x0 0
gs 0x0 0
st0 -nan(0xc000000000000000) (raw 0xffffc000000000000000)
st1 -0e+4922 (raw 0xffff0000000000000000)
st2 -0e+4922 (raw 0xffff0000000000000000)
st3 -0e+4922 (raw 0xffff0000000000000000)
st4 0 (raw 0x00000000000000000000)
st5 1 (raw 0x3fff8000000000000000)
st6 1 (raw 0x3fff8000000000000000)
st7 3 (raw 0x4000c000000000000000)
fctrl 0x37f 895
fstat 0x3a41 14913
ftag 0x0 0
fiseg 0x23 35
fioff 0x80aa359 134914905
foseg 0x2b 43
fooff 0xbf1ff790 -1088424048
fop 0x0 0
The st0 register gets -nan and so this is the result of the static_cast. From
what I can make of fpu docs, the stack overflow bit is set in fstat. The
problem does not occur when run outside the debugger, nor in a minimal test
program.
John
next reply other threads:[~2001-11-27 8:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-27 0:53 John Hedges [this message]
2001-11-16 13:40 ` John Hedges
2001-11-16 14:55 ` Eli Zaretskii
2001-11-17 5:39 ` John Hedges
2001-11-18 10:57 ` Andrew Cagney
2001-11-27 15:04 ` Andrew Cagney
2001-11-27 3:19 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E168dvs-0007FR-00@gwlinux \
--to=john@drystone.co.uk \
--cc=gdb@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox