[LLVMdev] Function inline causes crash in clang for .ast to .s

rajesh viswabramana viswabramana.rajesh at gmail.com
Wed Dec 19 05:24:30 PST 2012


Clang crashes when tried to compile from .ast to .s for below sample code,

*extern inline int func1 (void) { return 0; }
inline int func1 (void) { return 1; }*

clang *works fine* for .c -> .s,
*>clang inline-test.c -std=c99 -fgnu89-inline -S -o inline-test.s *

But *crashes* when tried to generate .s from .ast for same file,
*>clang inline-test.c -std=c99 -fgnu89-inline -emit-ast -o inline-test.ast*
*>clang inline-test.ast -std=c99 -fgnu89-inline -S -o inline-test.s*

clang-3.2: $HOME/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:342: void
clang::QualType, llvm::Function*, const clang::CodeGen::CGFunctionInfo&,
const clang::CodeGen::FunctionArgList&, clang::SourceLocation):
Assertion `*CurFn->isDeclaration()
&& "Function already has body?"*' failed.

>From crash message it seems Codegen is already emitted for inline function.

Crash occurs only if tried to generate assembly out of ast file.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121219/d2e79353/attachment.html>

More information about the llvm-dev mailing list