diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/asm-hard-reg-error-4.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/asm-hard-reg-error-4.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-error-4.c b/gcc/testsuite/gcc.dg/asm-hard-reg-error-4.c new file mode 100644 index 0000000..465f24b --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-hard-reg-error-4.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +/* Verify output operands. */ + +int +test (void) +{ + int x; + register int y __asm__ ("0"); + + /* Preserve status quo and don't error out. */ + __asm__ ("" : "=r" (x), "=r" (x)); + + /* Be more strict for hard register constraints and error out. */ + __asm__ ("" : "={0}" (x), "={1}" (x)); /* { dg-error "multiple outputs to lvalue 'x'" } */ + + /* Still error out in case of a mixture. */ + __asm__ ("" : "=r" (x), "={1}" (x)); /* { dg-error "multiple outputs to lvalue 'x'" } */ + + return x + y; +} |