[LLVMbugs] [Bug 10535] New: assertion (vs. proper diagnostic) on invalid (?) code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 29 14:16:06 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10535

           Summary: assertion (vs. proper diagnostic) on invalid (?) code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pageexec at freemail.hu
                CC: llvmbugs at cs.uiuc.edu


with current trunk i get this assertion (simplified example based on some linux
code that used to compile fine):

$ cat a.c
void f(void);
inline void f(void) { }
extern typeof(f) f;
$ clang -c a.c
clang: llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:266: 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.
0  libLLVM-3.0svn.so 0xa17b23d8
Stack dump:
0.      Program arguments: clang -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -main-file-name a.c -mrelocation-model
static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.21.1 -momit-leaf-frame-pointer
-coverage-file a.o -resource-dir lib/clang/3.0 -ferror-limit 19
-fmessage-length 277 -fdiagnostics-show-option -fcolor-diagnostics -o a.o -x c
a.c
1.      <eof> parser at end of file
2.      a.c:3:18: LLVM IR generation of declaration 'f'
3.      a.c:2:13: Generating code for declaration 'f'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)

if i remove 'inline' from the definition then it compiles fine. is the original
code wrong? in any case a proper diagnostic would still be better instead of an
assert.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list