[Bug inline-asm/78311] New: "register value used as expression" on i386 in inline assembly statement with "o" constraint

gcc at abeckmann dot de gcc-bugzilla@gcc.gnu.org
Fri Nov 11 12:30:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78311

            Bug ID: 78311
           Summary: "register value used as expression" on i386 in inline
                    assembly statement with "o" constraint
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at abeckmann dot de
  Target Milestone: ---

This is a regression from GCC 5 on i386. 

This code example has been minimized from uqm source which fails to build with
gcc-6 (but succeeds with gcc-5):

========== 8< ==========
extern unsigned int A [ 42 ] ;
void f ()
{
        __asm__ ( "movd %0 (, %%edx, 4), %%mm0 \n\t" : : "o" (*A) : "%edx" ) ;
}
========== >8 ==========

$ gcc-5 -m32 -W -Wall -c constraint-o.c ; echo $?
0

$ gcc-6 -m32 -W -Wall -c constraint-o.c; echo $?
constraint-o.c: Assembler messages:
constraint-o.c:4: Error: register value used as expression
1

========== assembly generated by gcc-5 -S ==========
        .globl  f
        .type   f, @function
f:
.LFB0:
        .cfi_startproc
        pushl   %ebp
        .cfi_def_cfa_offset 8
        .cfi_offset 5, -8
        movl    %esp, %ebp
        .cfi_def_cfa_register 5
#APP
# 4 "constraint-o.c" 1
        movd A (, %edx, 4), %mm0 

# 0 "" 2
#NO_APP
        nop
        popl    %ebp
        .cfi_restore 5
        .cfi_def_cfa 4, 4
        ret
        .cfi_endproc
==========

========== assembly generated by gcc-6 -S ==========
        .globl  f
        .type   f, @function
f:
.LFB0:
        .cfi_startproc
        pushl   %ebp
        .cfi_def_cfa_offset 8
        .cfi_offset 5, -8
        movl    %esp, %ebp
        .cfi_def_cfa_register 5
        call    __x86.get_pc_thunk.ax
        addl    $_GLOBAL_OFFSET_TABLE_, %eax
        movl    A@GOT(%eax), %eax
#APP
# 4 "constraint-o.c" 1
        movd (%eax) (, %edx, 4), %mm0 

# 0 "" 2
#NO_APP
        nop
        popl    %ebp
        .cfi_restore 5
        .cfi_def_cfa 4, 4
        ret
        .cfi_endproc
==========

$ gcc-6 --version
gcc-6 (Debian 6.2.0-10) 6.2.0 20161027
$ gcc-5 --version
gcc-5 (Debian 5.4.1-3) 5.4.1 20161019


More information about the Gcc-bugs mailing list