[Bug target/91900] New: [10 regression] mipsisa64r6-*-* rejects lo clobber

nsz at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 25 13:09:00 GMT 2019


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

            Bug ID: 91900
           Summary: [10 regression] mipsisa64r6-*-* rejects lo clobber
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

mips64 syscall code in musl is like

#define __NR_getpid 5038

static inline long __syscall0(long n)
{
 register long r7 __asm__("$7");
 register long r2 __asm__("$2") = n;
 __asm__ __volatile__ (
  "syscall"
  : "+&r"(r2), "=r"(r7)
  :
  : "$1", "$3", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi",
"lo", "memory");
 return r7 ? -r2 : r2;
}

int getpid()
{
  return __syscall0(__NR_getpid);
}

because linux clobbers all sorts of registers.
this compiles with mips64-linux-musl-gcc and
up to gcc-9 with mipsisa64r6-linux-musl-gcc too,
but mipsisa64r6-* fails with trunk gcc
(gcc version 10.0.0 20190924):

t.c: In function '__syscall0':
t.c:7:2: error: the register 'lo' cannot be clobbered in 'asm' for the current
target
    7 |  __asm__ __volatile__ (
      |  ^~~~~~~


More information about the Gcc-bugs mailing list