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

rajesh viswabramana viswabramana.rajesh at gmail.com
Fri Dec 28 04:21:02 PST 2012


Hi,

Could anyone please comment on this ?


Regards,
Rajesh


On Wed, Dec 19, 2012 at 6:54 PM, rajesh viswabramana <
viswabramana.rajesh at gmail.com> wrote:

> Hi,
>
> Clang crashes when tried to compile from .ast to .s for below sample code,
>
> inline-test.c
> **
> *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::CodeGen::CodeGenFunction::*StartFunction*(clang::GlobalDecl,
> 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.
>
>
> Regards,
> Rajesh
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121228/539cac03/attachment.html>


More information about the llvm-dev mailing list