This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug regression/18906] New: Assembler complains about previously acceptable code


The following code:

static inline int cpuid_edx(int op)
{
     int eax, ecx, edx;

     __asm__("push %%ebx\n\tcpuid\n\tpop %%ebx"
             : "=a" (eax), "=c" (ecx), "=d" (edx)
             : "a" (op));
     return edx;
}

int RIGHT_CPU(void)
{
     return cpuid_edx(1);
}

Compiles fine on a Fedora Core 2 system with gcc version 3.3.3 20040412 (Red Hat
Linux 3.3.3-7), and on a i386 FC3 system with gcc 3.4.2.

On x86_64 Fedora Core 3 with gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3) or
version 4.0.0 20041019 (Red Hat 4.0.0-0.8) I get the following error:

/tmp/cckzukZW.s: Assembler messages:
/tmp/cckzukZW.s:27: Error: suffix or operands invalid for `push'
/tmp/cckzukZW.s:29: Error: suffix or operands invalid for `pop'

Assembler code is:

        .file   "sse2-cpuid.c"
        .text
.globl RIGHT_CPU
        .type   RIGHT_CPU, @function
RIGHT_CPU:
.LFB3:
        pushq   %rbp
.LCFI0:
        movq    %rsp, %rbp
.LCFI1:
        movl    $1, %edi
        call    cpuid_edx
        leave
        ret
.LFE3:
        .size   RIGHT_CPU, .-RIGHT_CPU
        .type   cpuid_edx, @function
cpuid_edx:
.LFB2:
        pushq   %rbp
.LCFI2:
        movq    %rsp, %rbp
.LCFI3:
        movl    %edi, -4(%rbp)
        movl    -4(%rbp), %eax
#APP
        push %ebx
        cpuid
        pop %ebx
#NO_APP
        movl    %eax, -8(%rbp)
        movl    %ecx, %eax
        movl    %eax, -12(%rbp)
        movl    %edx, %eax
        movl    %eax, -16(%rbp)
        movl    -16(%rbp), %eax
        leave
        ret
.LFE2:
        .size   cpuid_edx, .-cpuid_edx
        .section        .eh_frame,"a",@progbits
.Lframe1:
        .long   .LECIE1-.LSCIE1
.LSCIE1:
        .long   0x0
        .byte   0x1
        .string ""
        .uleb128 0x1
        .sleb128 -8
        .byte   0x10
        .byte   0xc
        .uleb128 0x7
        .uleb128 0x8
        .byte   0x90
        .uleb128 0x1
        .align 8
.LECIE1:
.LSFDE1:
        .long   .LEFDE1-.LASFDE1
.LASFDE1:
        .long   .LASFDE1-.Lframe1
        .quad   .LFB3
        .quad   .LFE3-.LFB3
        .byte   0x4
        .long   .LCFI0-.LFB3
        .byte   0xe
        .uleb128 0x10
        .byte   0x86
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI1-.LCFI0
        .byte   0xd
        .uleb128 0x6
        .align 8
.LEFDE1:
.LSFDE3:
        .long   .LEFDE3-.LASFDE3
.LASFDE3:
        .long   .LASFDE3-.Lframe1
        .quad   .LFB2
        .quad   .LFE2-.LFB2
        .byte   0x4
        .long   .LCFI2-.LFB2
        .byte   0xe
       .uleb128 0x10
        .byte   0x86
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI3-.LCFI2
        .byte   0xd
        .uleb128 0x6
        .align 8
.LEFDE3:
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)"

-- 
           Summary: Assembler complains about previously acceptable code
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: orion at cora dot nwra dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-redhat-linux-gnu
  GCC host triplet: x86_64-redhat-linux-gnu
GCC target triplet: x86_64-redhat-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18906


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