From 3857eed4be8d6c300a3cb6ccc9ff1a23a2cfdff1 Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Wed, 11 May 2016 13:28:15 +0300 Subject: Add test for PR24071 --- test/CodeGen/arm64-asm-diag.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/CodeGen/arm64-asm-diag.c diff --git a/test/CodeGen/arm64-asm-diag.c b/test/CodeGen/arm64-asm-diag.c new file mode 100644 index 0000000000..49b248f6bd --- /dev/null +++ b/test/CodeGen/arm64-asm-diag.c @@ -0,0 +1,24 @@ +// RUN: not %clang_cc1 -triple arm64 %s -S -o /dev/null 2>&1 | FileCheck %s + +// This test makes sure that we correctly recover after an error is identified +// in inline asm during instruction selection. +// It needs to be in Clang because the diagnostic handler that is used by llc +// in LLVM's CodeGen tests exits after identifying an error, whereas the +// diagnostic handler used by Clang keeps running and may trigger assertions +// (see PR24071). +// This test as well as arm-asm-diag.c can be moved back into LLVM if llc is +// updated to use a different diagnostic handler, that tries to catch as many +// errors as possible without exiting. +int foo(long int a, long int b){ + const long int c = 32 - b; + + long int r; + asm("lsl %[o],%[s],%[a]" + : [o] "=r" (r) + : [s] "r" (a), + [a] "n" (c)); + + return r; +} + +// CHECK: error: invalid operand for inline asm constraint 'n' -- cgit v1.2.3