tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] error: invalid clobber register '%rcx'


From: Somchai Smythe
Subject: [Tinycc-devel] error: invalid clobber register '%rcx'
Date: Tue, 20 Dec 2016 12:00:29 +0700

Hello,

    The code works with gcc-6.2.0, clang 3.9.0, pcc from 20161212, but
not with tcc (either ed99f3608df3d6dd4c8c7d52d608a8212203dfe4 or the
old version shipped with Ubuntu 16.10).  I am working on x86-64 Linux
with recent 4.x kernels.

trouble.c:18: error: invalid clobber register '%rcx'

     Is this a bug in tcc or does it just not support clobbers yet?

------8<  cut here   8<------
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#define __NR_write 1UL

void outputbuf(void);

void outputbuf(void) {
  char OBUF[] = "I AM HAVING TROUBLE WITH CLOBBERS\n";
  unsigned long int OUTPUT_WIDTH = (unsigned long int)strlen(OBUF);
  signed long int ret;

  asm volatile (
     "syscall"
     : "=a" (ret)
     : "0"(__NR_write), "D"(STDOUT_FILENO), "S"(OBUF), "d"(OUTPUT_WIDTH)
     : "cc", "%rcx", "%r11", "memory"
  );
  if (ret < 0L) abort();
  return;
}

int main(void) {
  outputbuf();
  return EXIT_SUCCESS;
}
------8<  cut here   8<------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]