[cfe-dev] Clang diagnostics for inline asm
Diana Picus via cfe-dev
cfe-dev at lists.llvm.org
Mon May 9 08:09:03 PDT 2016
Hi all,
While looking at PR24071 [1] I have noticed that compiling a .c file
with certain inline asm errors may behave differently [2] than
compiling its corresponding .ll file[3]:
When compiling the .ll file, the error is reported and then exit() is
called - this is because the LLVMContext does not have a
DiagnosticHandler set (see LLVMContext::diagnose).
When compiling the .c file, the error is reported, but we do not exit
and we run into a nice assertion later on because FastISel and
SelectionDAGBuilder don't get along - the reason why we don't exit is
because in this case we have a DiagnosticHandler set in LLVMContext
(clang::BackendConsumer::InlineAsmDiagHandler).
What is the intended behaviour here? Should compiling an .ll file
report the error and continue gracefully, or should the inline asm
handler exit when finding an error in a .c file?
Thanks,
Diana
[1] https://llvm.org/bugs/show_bug.cgi?id=24071
[2]
clang crashycase.c
crashycase.c:5:9: error: invalid operand for inline asm constraint 'n'
asm("lsl %[o],%[s],%[a]"
^
clang-3.9: /blah/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h:225:
unsigned int llvm::FunctionLoweringInfo::InitializeRegForValue(const
llvm::Value*): Assertion `R == 0 && "Already initialized this value
register!"' failed.
[snip]
[3]
clang crashycase.c -S -emit-llvm -o crashycase.ll
clang crashycase.ll
error: invalid operand for inline asm constraint 'n' at line 91
[no assertion, yay]
More information about the cfe-dev
mailing list