c/10430: converting double word to quad word, cltd, cdq, 3.2.2

aaron@cs.wisc.edu aaron@cs.wisc.edu
Fri Apr 18 00:06:00 GMT 2003


>Number:         10430
>Category:       c
>Synopsis:       converting double word to quad word, cltd, cdq, 3.2.2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 18 00:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Aaron Wegner
>Release:        unknown-1.0
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
-------
Problem
-------
The problem is that cldt will replace whatever is in %edx with zeros or ones.  Correct code omits cldt.
--------
C Source
--------
main()
{
  foo((unsigned long long int) bar());
}
-------------------------
Generated Assember Source
-------------------------
        .file   "test.c"
        .text
.globl main
        .type   main,@function
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
        call    bar
        cltd
        movl    %eax, (%esp)
        movl    %edx, 4(%esp)
        call    foo
        leave
        ret
.Lfe1:
        .size   main,.Lfe1-main
        .ident  "GCC: (GNU) 3.2.2"
>How-To-Repeat:
gcc -S test.c
>Fix:
Unsure still.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list