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]

CVS g++ on alpha ICE with asm



the following fails on alpha/linux with current CVS when compiled with
g++, but not with gcc. I've not seen any problems on x86/linux.

<bkoz@fidel.cygnus.com> {/horton/bkoz/bld-alpha-libstdc++/src}                  % g++ kill2.c
kill2.c:5: ISO C++ forbids declaration of `exchange_and_add' with no
kill2.c:5: type
kill2.c: In function `int exchange_and_add (volatile uint32_t *, int)':
kill2.c:22: Internal compiler error in `emit_move_insn', at expr.c:2550
kill2.c:22: Please submit a full bug report.
kill2.c:22: See <URL:http://www.gnu.org/software/gcc/bugs.html> for
kill2.c:22: instructions.
<bkoz@fidel.cygnus.com> {/horton/bkoz/bld-alpha-libstdc++/src}                  % gcc kill2.c
/usr/lib/crt1.o: In function `_start':
../sysdeps/alpha/elf/start.S:36: undefined reference to `main'
collect2: ld returned 1 exit status
<bkoz@fidel.cygnus.com> {/horton/bkoz/bld-alpha-libstdc++/src}                  % 

-benjamin

//-------kill2.c
typedef unsigned int       uint32_t;

__attribute__ ((unused))
exchange_and_add (volatile uint32_t *mem, int val)
{
  register int result, tmp;

  __asm__ __volatile__ (
        "/* Inline exchange & add */\n"
        "1:\t"
        "ldl_l  %0,%3\n\t"
        "addl   %0,%4,%1\n\t"
        "stl_c  %1,%2\n\t"
        "beq    %1,2f\n"
        ".subsection 1\n"
        "2:\t"
        "br     1b\n"
        ".previous\n\t"
        "mb\n\t"
        "/* End exchange & add */"
        : "=&r"(result), "=&r"(tmp), "=m"(*mem)
        : "m" (*mem), "r"(val));

  return result;
}

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