Index: test/CodeGen/arm64-asm-diag.c =================================================================== --- /dev/null +++ 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'