This is the mail archive of the gdb-prs@sources.redhat.com 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]

breakpoints/1321: GDB: problem with FPU


>Number:         1321
>Category:       breakpoints
>Synopsis:       GDB: problem with FPU
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 06 05:48:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     sana@stl.sarov.ru
>Release:        unknown-1.0
>Organization:
>Environment:
32 bit Linux, RH7.2
>Description:
Strange problem with GDB on RH7.2 only.

Very simple test is (real failed tests are more complex but this simple test reproduces situation): 

        program attribute_save 
        real r 
        i = 1 
        r = 2.0 
        print *,r 
        end 

Assembler is (interesting fragment): 

08049528 <MAIN__>: 
 8049528:       55                      push   %ebp 
 8049529:       8b ec                   mov    %esp,%ebp 
 804952b:       83 ec 03                sub    $0x3,%esp 
 804952e:       83 e4 f8                and    $0xfffffff8,%esp 
 8049531:       83 c4 04                add    $0x4,%esp 
 8049534:       83 ec 24                sub    $0x24,%esp 
 8049537:       c7 05 ec 38 0a 08 01    movl   $0x1,0x80a38ec 
 804953e:       00 00 00 
 8049541:       d9 05 b0 81 09 08       flds   0x80981b0 
 8049547:       d9 1d f0 38 0a 08       fstps  0x80a38f0 
 804954d:       c7 45 dc 00 00 00 00    movl   $0x0,0xffffffdc(%ebp) 
 8049554:       d9 05 f0 38 0a 08       flds   0x80a38f0 
 804955a:       d9 1d e8 38 0a 08       fstps  0x80a38e8 

Situation is 

     - debug line is so that result of command 'b attribute_save' is stopping at address 0x8049547 (instruction fstps). And here we have real problem because 

       instruction flds is performed already and FPU data register stack contains value 2.0 really but register 'ftag' shows that FPU data register stack is empty! 

       As result instruction fstps is performed incorrectly and tests are failed. 
       GDB output: 
           
This GDB was configured as "i386-redhat-linux"... 
(gdb) b attribute_save 
Breakpoint 1 at 0x8049547: file test.f, line 3. 
(gdb) r 
Starting program: /home1/sana/trackers/ifort_testing/gdbF/opt_none_debug/test.exe 
[New Thread 1024 (LWP 2985)] 
[Switching to Thread 1024 (LWP 2985)] 

Breakpoint 1, attribute_save () at test.f:3 
3               i = 1 
Current language:  auto; currently fortran 
(gdb) info all-reg 
eax            0xffff023f       -64961 
ecx            0xbffff6e4       -1073744156 
edx            0x3f     63 
ebx            0x401c6154       1075601748 
esp            0xbffff770       0xbffff770 
ebp            0xbffff798       0xbffff798 
............................... 
st0            2        (raw 0x40008000000000000000) 
st1            -nan(0xdb6db6db6db6db6d) (raw 0xffffdb6db6db6db6db6d) 
st2            -nan(0x000800000)        (raw 0xffff0000000000800000) 
st3            0        (raw 0x00000000000000000000) 
st4            0        (raw 0x00000000000000000000) 
st5            0        (raw 0x00000000000000000000) 
---Type <return> to continue, or q <return> to quit--- 
st6            1        (raw 0x3fff8000000000000000) 
st7            0        (raw 0x00000000000000000000) 
fctrl          0x27f    639 
fstat          0x3800   14336 
ftag           0xffff   65535 
fiseg          0x23     35 
fioff          0x8049541        134518081 
foseg          0x2b     43 
fooff          0x80981b0        134840752 
fop            0x105    261 
.................................. 
(gdb) p r 
$1 = -nan(0x400000) 
(gdb) n 
 NaN           
6               end 
    
IDB works correctly with this situation (with th esame binary). 

           - if breakpoint is set at address before of after instruction fstps then GDB works correctly! 
             (Also I tried to add instructions between flds and fstps and set breakpoitn at those instructions. GDB behaviour was as above (ftag was not set) ).

             GDB output  is in this case (if it works correctly): 

This GDB was configured as "i386-redhat-linux"... 
(gdb) b *(0x8049541) 
Breakpoint 1 at 0x8049541: file test.f, line 1. 
(gdb) r 
Starting program: /home1/sana/trackers/ifort_testing/gdbF/opt_none_debug/test.exe 
[New Thread 1024 (LWP 3004)] 
[Switching to Thread 1024 (LWP 3004)] 

Breakpoint 1, 0x08049541 in attribute_save () at test.f:1 
1               program attribute_save 
Current language:  auto; currently fortran 
(gdb) si 
3               i = 1 
(gdb) info all-reg 
eax            0xffff023f       -64961 
ecx            0xbffff6e4       -1073744156 
edx            0x3f     63 
ebx            0x401c6154       1075601748 
esp            0xbffff770       0xbffff770 
ebp            0xbffff798       0xbffff798 
esi            0x400168e4       1073834212 
edi            0xbffff814       -1073743852 
eip            0x8049547        0x8049547 
eflags         0x382    898 
.............................. 
st0            2        (raw 0x40008000000000000000) 
st1            -nan(0xdb6db6db6db6db6d) (raw 0xffffdb6db6db6db6db6d) 
st2            -nan(0x000800000)        (raw 0xffff0000000000800000) 
st3            0        (raw 0x00000000000000000000) 
st4            0        (raw 0x00000000000000000000) 
st5            0        (raw 0x00000000000000000000) 
---Type <return> to continue, or q <return> to quit--- 
st6            1        (raw 0x3fff8000000000000000) 
st7            0        (raw 0x00000000000000000000) 
fctrl          0x27f    639 
fstat          0x3800   14336 
ftag           0x3fff   16383 
fiseg          0x23     35 
fioff          0x8049541        134518081 
foseg          0x2b     43 
fooff          0x80981b0        134840752 
fop            0x105    261 
................................. 
(gdb) n 
5               print *,r 
(gdb) 
   2.000000    
6               end 
(gdb)    

>How-To-Repeat:
It is necessary to use intel compiler 8.0.
Command line is 'ifort -g test.f90'.
Reression test is:

      program attribute_save 
        real r 
        i = 1 
        r = 2.0 
        print *,r 
        end 

Situation is notreproduced on RH7.3 and RH8.0.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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