[LLVMbugs] [Bug 22017] New: assertion "Comparison requires equal bit widths"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Dec 23 11:34:54 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=22017
Bug ID: 22017
Summary: assertion "Comparison requires equal bit widths"
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: nlewycky at google.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Reduced testcase:
enum E : bool { A };
template<E> struct S {
struct Inner {
Inner() {}
};
};
template class S<A>;
$ clang -cc1 -emit-llvm-only -std=gnu++11 b18841109.cc
clang: /usr/local/google/home/nlewycky/llvm/include/llvm/ADT/APInt.h:973: bool
llvm::APInt::operator==(const llvm::APInt &) const: Assertion `BitWidth ==
RHS.BitWidth && "Comparison requires equal bit widths"' failed.
0 clang 0x000000000440e68e llvm::sys::PrintStackTrace(_IO_FILE*) +
46
[...]
12 clang 0x0000000002833399
clang::TemplateArgument::print(clang::PrintingPolicy const&,
llvm::raw_ostream&) const + 553
13 clang 0x00000000028514fc
clang::TemplateSpecializationType::PrintTemplateArgumentList(llvm::raw_ostream&,
clang::TemplateArgument const*, unsigned int, clang::PrintingPolicy const&,
bool) + 412
14 clang 0x00000000026b4ce0
clang::NamedDecl::printQualifiedName(llvm::raw_ostream&, clang::PrintingPolicy
const&) const + 464
15 clang 0x00000000026b51c3
clang::NamedDecl::printQualifiedName(llvm::raw_ostream&) const + 67
16 clang 0x0000000000f8e050
clang::CodeGen::CodeGenTypes::addRecordTypeName(clang::RecordDecl const*,
llvm::StructType*, llvm::StringRef) + 224
17 clang 0x0000000000f8fe63
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) +
211
18 clang 0x0000000000f8e31f
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 143
19 clang 0x0000000000f8e227
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) + 55
20 clang 0x0000000000f8e7b0
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 1312
21 clang 0x0000000000fcfc9c
22 clang 0x0000000000fd33f5
23 clang 0x0000000001000de8
clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>,
bool, bool, llvm::ArrayRef<clang::CanQual<clang::Type> >,
clang::FunctionType::ExtInfo, clang::CodeGen::RequiredArgs) + 840
24 clang 0x0000000001001c76
clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration(clang::CXXMethodDecl
const*, clang::CodeGen::StructorType) + 1078
25 clang 0x0000000000ffe3b8
clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::CXXMethodDecl const*,
clang::CodeGen::StructorType) + 56
26 clang 0x0000000000f9d992
27 clang 0x0000000000eceb4a
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 362
28 clang 0x0000000000ed10cc
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 876
29 clang 0x0000000000f99e41
30 clang 0x0000000000ed4924
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 740
31 clang 0x0000000000e1fc58
32 clang 0x0000000000e062a8
33 clang 0x00000000018bbcba
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2826
34 clang 0x000000000186b9c9
clang::Sema::InstantiateClassMembers(clang::SourceLocation,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind) + 793
35 clang 0x000000000186bf73
clang::Sema::InstantiateClassMembers(clang::SourceLocation,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind) + 2243
36 clang 0x000000000186c397
clang::Sema::InstantiateClassTemplateSpecializationMembers(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind) +
135
37 clang 0x0000000001796dac
clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation,
clang::SourceLocation, unsigned int, clang::SourceLocation, clang::CXXScopeSpec
const&, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation,
clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>,
clang::SourceLocation, clang::AttributeList*) + 2764
38 clang 0x0000000001196dcd
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 6941
39 clang 0x000000000117774c
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 10540
40 clang 0x00000000011f69a6
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 582
41 clang 0x00000000011f5fd0
clang::Parser::ParseExplicitInstantiation(unsigned int, clang::SourceLocation,
clang::SourceLocation, clang::SourceLocation&, clang::AccessSpecifier) + 192
42 clang 0x00000000011f5ec0
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 176
43 clang 0x000000000117497b clang::Parser::ParseDeclaration(unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 459
44 clang 0x000000000115ef7d
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2413
45 clang 0x000000000115e3d2
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 770
46 clang 0x00000000011597f1 clang::ParseAST(clang::Sema&, bool, bool)
+ 561
[...]
Stack dump:
0. Program arguments: llvm/Debug+Asserts/bin/clang -cc1 a.cc
-std=gnu++11 -emit-llvm-only
1. a.cc:7:20: current parser token ';'
2. a.cc:4:5: LLVM IR generation of declaration 'S<clang:
/usr/local/google/home/nlewycky/llvm/include/llvm/ADT/APInt.h:973: bool
llvm::APInt::operator==(const llvm::APInt &) const: Assertion `BitWidth ==
RHS.BitWidth && "Comparison requires equal bit widths"' failed.
It's also very easy to get a crash on invalid with the same thing, by going
through the diagnostic system to call TemplateArgument::print instead of name
mangling. For example:
enum E : bool { A };
template<E> struct S : S<A>
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141223/cd184ecf/attachment.html>
More information about the llvm-bugs
mailing list