public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/37195]  New: unrelated variables get the same memory address in inline assembly
@ 2008-08-21 21:15 jdemeyer at cage dot ugent dot be
  2008-08-21 21:17 ` [Bug inline-asm/37195] " jdemeyer at cage dot ugent dot be
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jdemeyer at cage dot ugent dot be @ 2008-08-21 21:15 UTC (permalink / raw)
  To: gcc-bugs

In the following inline assembly statement (the second one in the attached
program), the operands %0 and %5 are stored in exactly the same memory address
-44(%ebp), even though they refer to different variables (and all the output
constraints have the earlyclobber modifier).

asm("   shrdl %6, %4, %3\n"
    "   movl %3, %0\n"
    "   movl %5, %2\n"
    "   shrdl %6, %2, %1\n"
    "   shrl %6, %2\n"
    : "=&rm" (d0), "=&r" (d1), "=&r" (d2)
    : "2" (c0), "1" (c1), "g" (c2), "cI" (s)
    : "%eax", "%esi", "%edi", "cc"
);

This code is compiled as
    shrdl %cl, %edx, %ebx
    movl %ebx, -40(%ebp)
    movl -40(%ebp), %ebx
    shrdl %cl, %ebx, %edx
    shrl %cl, %ebx


Command line:
gcc-4.2.4 -O1 -save-temps asmtest.c -c -o asmtest.o

Note: gcc 4.3.1 does not seem to have this problem.


Output of gcc -v:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.2.4/work/gcc-4.2.4/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.2.4
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.4
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.4/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.4/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --enable-secureplt --disable-multilib --enable-libmudflap
--disable-libssp --disable-libgcj --with-arch=i686
--enable-languages=c,c++,treelang,fortran --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.2.4 (Gentoo 4.2.4)


-- 
           Summary: unrelated variables get the same memory address in
                    inline assembly
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jdemeyer at cage dot ugent dot be
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2010-04-30  7:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-21 21:15 [Bug inline-asm/37195] New: unrelated variables get the same memory address in inline assembly jdemeyer at cage dot ugent dot be
2008-08-21 21:17 ` [Bug inline-asm/37195] " jdemeyer at cage dot ugent dot be
2008-09-01 18:19 ` jdemeyer at cage dot ugent dot be
2008-09-01 18:20 ` jdemeyer at cage dot ugent dot be
2008-09-01 21:26 ` jdemeyer at cage dot ugent dot be
2008-09-02  8:53 ` jdemeyer at cage dot ugent dot be
2008-09-03  7:59 ` [Bug inline-asm/37195] different " jdemeyer at cage dot ugent dot be
2008-09-29 19:23 ` [Bug inline-asm/37195] different variables get the same overlapping " jdemeyer at cage dot ugent dot be
2008-12-25 17:19 ` pinskia at gcc dot gnu dot org
2009-11-21  9:15 ` pinskia at gcc dot gnu dot org
2010-04-30  7:25 ` jdemeyer at cage dot ugent dot be

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).