public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/10430: converting double word to quad word, cltd, cdq, 3.2.2
@ 2003-04-18  0:06 aaron
  0 siblings, 0 replies; 2+ messages in thread
From: aaron @ 2003-04-18  0:06 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c/10430: converting double word to quad word, cltd, cdq, 3.2.2
@ 2003-04-18  7:45 ebotcazou
  0 siblings, 0 replies; 2+ messages in thread
From: ebotcazou @ 2003-04-18  7:45 UTC (permalink / raw)
  To: aaron, gcc-bugs, gcc-prs, nobody

Synopsis: converting double word to quad word, cltd, cdq, 3.2.2

State-Changed-From-To: open->closed
State-Changed-By: ebotcazou
State-Changed-When: Fri Apr 18 07:45:23 2003
State-Changed-Why:
    Not a bug. The code is equivalent to
    
    extern int bar(void);
    
    main()
    {
      foo((unsigned long long int) bar());
    }
    
    Since the return type of bar() is signed, the return value
    must be sign-extended according to the ISO C standard, hence
    the use of 'cltd'.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10430


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-18  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-18  0:06 c/10430: converting double word to quad word, cltd, cdq, 3.2.2 aaron
2003-04-18  7:45 ebotcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).