www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5647] New: Valgrind complains about illegal instruction

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5647

           Summary: Valgrind complains about illegal instruction
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: minthos gmail.com



---
I don't know if this is a bug in valgrind or dmd, but here goes:

I compile a small sample program with dmd version 2.052 and the -m64 flag.
Then I run the resulting binary in valgrind-3.6.0.SVN-Debian on ubuntu 10.04
x86_64

Valgrind complains:
==24857== Process terminating with default action of signal 4 (SIGILL)
==24857==  Illegal opcode at address 0x417862


$ cat bug.d
ulong rtt;

void updateRTT(ulong time){
    float mtime = cast(double)(time);
    mtime *= 0.0001;
    mtime += cast(double)(rtt);
    mtime *= 0.90;
    rtt = cast(ulong)(mtime);
}

void main(){
    rtt = 200;
    updateRTT(1000);
}



$ objdump -d bug | grep '417862' -B8 -A19
000000000041784c <_D3bug9updateRTTFmZv>:
  41784c:    55                       push   %rbp
  41784d:    48 8b ec                 mov    %rsp,%rbp
  417850:    48 83 ec 20              sub    $0x20,%rsp
  417854:    48 89 f8                 mov    %rdi,%rax
  417857:    e8 30 3d 00 00           callq  41b58c <__U64_LDBL>
  41785c:    d9 5d f0                 fstps  -0x10(%rbp)
  41785f:    d9 45 f0                 flds   -0x10(%rbp)

42bc80 <_IO_stdin_used+0x10>
  417869:    d9 5d f0                 fstps  -0x10(%rbp)
  41786c:    d9 45 f0                 flds   -0x10(%rbp)
  41786f:    64 48 8b 0c 25 00 00     mov    %fs:0x0,%rcx
  417876:    00 00 

632fd0 <_DYNAMIC+0x208>
  41787f:    48 8b 01                 mov    (%rcx),%rax
  417882:    e8 05 3d 00 00           callq  41b58c <__U64_LDBL>
  417887:    de c1                    faddp  %st,%st(1)
  417889:    d9 5d f0                 fstps  -0x10(%rbp)
  41788c:    d9 45 f0                 flds   -0x10(%rbp)

42bc88 <_IO_stdin_used+0x18>
  417896:    d9 5d f0                 fstps  -0x10(%rbp)
  417899:    d9 45 f0                 flds   -0x10(%rbp)
  41789c:    dd 5d e8                 fstpl  -0x18(%rbp)
  41789f:    48 8b 45 e8              mov    -0x18(%rbp),%rax
  4178a3:    e8 04 3d 00 00           callq  41b5ac <__DBLULLNG>
  4178a8:    48 89 01                 mov    %rax,(%rcx)
  4178ab:    c9                       leaveq 
  4178ac:    c3                       retq

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5647


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



19:21:50 PST ---
https://github.com/D-Programming-Language/dmd/commit/afed6b42a39d8b07bce17abf819afec5f9d98b69

https://github.com/D-Programming-Language/dmd/commit/03abec0f1460bd0047eeeffce905baf978cc6e29

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 03 2011