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 c/32642] New: Extended Asm modification of a range of bytes


There seems to be a problem either with the doc or with GCC in this case,
 I am not sure that has ever worked neither.

[etienne@localhost ~]$ cat tmp.c
/* info gcc -> Extended Asm
If you know how large the accessed memory is, you can add it
as input or output but if this is not known, you should add `memory'.
As an example, if you access ten bytes of a string, you can use a
memory input like:
        {"m"( ({ struct { char x[10]; } *p = (void *)ptr ; *p; }) )}.
*/
void lmemcpy (void *dst, unsigned src, unsigned short size)
  {
  unsigned dummy;
  asm volatile (
"       pushl   %4                                              \n"
"       popw    %%si                                            \n"
"       popw    %%fs                                            \n"
"       cld             # lmemcpy modify %3                     \n"
"       rep movsb %%fs:(%%si),%%es:(%%di)       # no macro      \n"
"       nop                                                     \n"
        : "=S" (dummy), "+D" (dst), "+c" (size),
         "=m" ( ({ struct { char x[10]; } *p = (void *)dst ; *p; }) )
        : "g" (src)
        : "cc", "memory"
        );
  }

[etienne@localhost ~]$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)
[etienne@localhost ~]$ gcc -O2 tmp.c
tmp.c: In function "lmemcpy":
tmp.c:22: error: invalid lvalue in asm statement
tmp.c:11: error: invalid lvalue in asm output 3
[etienne@localhost ~]$ 

 Thanks,
 Etienne.


-- 
           Summary: Extended Asm modification of a range of bytes
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: etienne_lorrain at yahoo dot fr
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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


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