[Issue 5647] New: Valgrind complains about illegal instruction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 23 15:41:34 PST 2011


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 at puremagic.com
        ReportedBy: minthos at gmail.com


--- Comment #0 from Espen Overaae <minthos at gmail.com> 2011-02-23 15:38:50 PST ---
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)
  417862:    48 dc 0d 17 44 01 00     rex.W fmull  0x14417(%rip)        #
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 
  417878:    48 03 0d 51 b7 21 00     add    0x21b751(%rip),%rcx        #
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)
  41788f:    48 dc 0d f2 43 01 00     rex.W fmull  0x143f2(%rip)        #
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: -------


More information about the Digitalmars-d-bugs mailing list