[LLVMbugs] [Bug 7859] New: Assertion failed: (OldFn->isDeclaration() && "Shouldn't replace non-declaration")
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 10 00:04:48 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7859
Summary: Assertion failed: (OldFn->isDeclaration() &&
"Shouldn't replace non-declaration")
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: wendling at apple.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
>From llvm-gcc's testsuite: This code fails when compiled with clang++.
$ cat prototype.C
void foo() { } /* { dg-warning "no previous prototype" } */
void foo(int i) { } /* { dg-warning "no previous prototype" } */
void bar();
void bar() { }
void bar1();
void bar1(int i);
void bar1(int i) { }
void bar1(float) { } /* { dg-warning "no previous prototype" } */
extern "C" void bar1(char);
extern "C" void bar1(char) { } /* { dg-error "previous declaration" } */
extern "C" void bar1(short); /* { dg-error "conflicts with" } */
extern "C" void bar1(short) { }
extern "C" void bar2(char);
extern "C" void bar2(char) { } /* { dg-error "previous declaration" } */
extern "C" void bar2(short) { } /* { dg-error "conflicts with" } */
extern "C" void bar3(char);
extern "C" void bar3(char) { } /* { dg-error "previous declaration" } */
extern "C" void bar3(short) { } /* { dg-error "conflicts with" } */
struct beef { };
void beef() { } /* { dg-warning "no previous prototype" } */
void dead();
namespace {
void dead() { }
}
void dead4();
namespace A {
void dead4() { } /* { dg-warning "no previous prototype" } */
}
void dead1();
namespace A {
void dead1(int);
void dead1() { } /* { dg-warning "no previous prototype" } */
}
void dead2(); /* { dg-error "old declaration" } */
int dead2() { } /* { dg-error "new declaration" } */
struct undef;
undef meat; /* { dg-error "incomplete type and cannot be defined" }
*/
double meat() { }
static void local() { }
int main() { }
void exit(float);
void exit(int e) { a: goto a; } /* { dg-warning "no previous prototype" } */
void dead3(float);
int dead3(int); /* { dg-error "old declaration" } */
void dead3(int e) { a: goto a; }/* { dg-error "new declaration" } */
class A {
void m();
};
void A::m() { }
namespace {
void m() { }
};
$ clang++ -Wmissing-prototypes prototype.C -c -o /dev/null
prototype.C:4:6: warning: no previous prototype for function 'foo'
[-Wmissing-prototypes]
void foo() { } /* { dg-warning "no previous prototype" } */
^
prototype.C:5:6: warning: no previous prototype for function 'foo'
[-Wmissing-prototypes]
void foo(int i) { } /* { dg-warning "no previous prototype" } */
^
prototype.C:11:6: warning: no previous prototype for function 'bar1'
[-Wmissing-prototypes]
void bar1(float) { } /* { dg-warning "no previous prototype" } */
^
Assertion failed: (OldFn->isDeclaration() && "Shouldn't replace
non-declaration"), function EmitGlobalFunctionDefinition, file
/Users/void/llvm/llvm.src/tools/clang/lib/Code\
Gen/CodeGenModule.cpp, line 1311.
0 clang 0x000000010130ebf2 PrintStackTrace(void*) + 34
1 clang 0x000000010130f893 SignalHandler(int) + 707
2 libSystem.B.dylib 0x00007fff801f935a _sigtramp + 26
3 clang 0x00000001011d0b5b std::_Rb_tree<std::pair<llvm::Type
const*, llvm::ExprMapKeyType>, std::pair<std::pair<llvm::Type const*,
llvm::ExprMapKeyType> const,\
llvm::ConstantExpr*>, std::_Select1st<std::pair<std::pair<llvm::Type const*,
llvm::ExprMapKeyType> const, llvm::ConstantExpr*> >,
std::less<std::pair<llvm::Type const*, llv\
m::ExprMapKeyType> >, std::allocator<std::pair<std::pair<llvm::Type const*,
llvm::ExprMapKeyType> const, llvm::ConstantExpr*> >
>::_M_insert_unique(std::_Rb_tree_iterator<st\
d::pair<std::pair<llvm::Type const*, llvm::ExprMapKeyType> const,
llvm::ConstantExpr*> >, std::pair<std::pair<llvm::Type const*,
llvm::ExprMapKeyType> const, llvm::ConstantE\
xpr*> const&) + 891
4 libSystem.B.dylib 0x00007fff802749b4 __pthread_markcancel + 0
5 clang 0x000000010027c8c2
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::CodeGen::GlobalDecl)
+ 1586
6 clang 0x000000010027f89a
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::CodeGen::GlobalDecl)
+ 378
7 clang 0x000000010027fb2f
clang::CodeGen::CodeGenModule::EmitGlobal(clang::CodeGen::GlobalDecl) + 495
8 clang 0x00000001002804e0
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 752
9 clang 0x000000010028069b
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 1195
10 clang 0x00000001002992ac (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 60
11 clang 0x0000000100269d0b (anonymous
namespace)::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 155
12 clang 0x00000001002ae0a2 clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*) + 258
13 clang 0x000000010026a5dc clang::CodeGenAction::ExecuteAction() +
60
14 clang 0x000000010004fc59
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 393
15 clang 0x000000010001fc75 cc1_main(char const**, char const**,
char const*, void*) + 2949
16 clang 0x00000001000269a4 main + 4740
17 clang 0x000000010001dda8 start + 52
18 clang 0x0000000000000021 start + 4294845101
Stack dump:
0. Program arguments:
/Users/void/llvm/llvm-opt.obj/Release+Asserts/bin/clang -cc1 -triple
x86_64-apple-darwin10.0.0 -emit-obj -mrelax-all -disable-free -main-file-name\
prototype.C -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu core2 -resource-dir
/Users/void/llvm/llvm-opt.obj/Release+Asserts/lib/clang/2.8 -Wmissi\
ng-prototypes -ferror-limit 19 -fmessage-length 120 -stack-protector 1 -fblocks
-fexceptions -fdiagnostics-show-option -o /dev/null -x c++ prototype.C
1. prototype.C:16:1: current parser token 'extern'
2. prototype.C:15:8: LLVM IR generation of declaration
3. prototype.C:15:17: Generating code for declaration 'bar1'
clang: error: clang frontend command failed due to signal 6 (use -v to see
invocation)
--
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