Function inline causes crash in clang for .ast to .s


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::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.



Could anyone please comment on this ?


For crashes you should open a bug report instead of mailing one of the dev
lists: There is some more information on filing bug
reports here:

(Also, in the future questions related to Clang should go to cfe-dev).