[llvm-bugs] [Bug 37366] New: static llvm::IntegerType* llvm::IntegerType::get(llvm::LLVMContext&, unsigned int): Assertion `NumBits >= MIN_INT_BITS && "bitwidth too small"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 8 05:13:17 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37366

            Bug ID: 37366
           Summary: static llvm::IntegerType*
                    llvm::IntegerType::get(llvm::LLVMContext&, unsigned
                    int): Assertion `NumBits >= MIN_INT_BITS && "bitwidth
                    too small"' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vegard.nossum at gmail.com
                CC: llvm-bugs at lists.llvm.org

Input:

class A {
  int : -1ULL;
};
void fn1() { A(); }

Output:

$ clang++ -x c++ -c -
<stdin>:2:7: warning: width of anonymous bit-field (4294967295 bits) exceeds
width of its type; value will be truncated to 32 bits [-Wbitfield-width]
  int : -1ULL;
      ^
clang-7: /home/vegard/llvm/lib/IR/Type.cpp:241: static llvm::IntegerType*
llvm::IntegerType::get(llvm::LLVMContext&, unsigned int): Assertion `NumBits >=
MIN_INT_BITS && "bitwidth too small"' failed.
Stack dump:
0.      Program arguments: /home/vegard/llvm-build/bin/clang-7 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name -
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file
/home/vegard/creduce/-.gcno -resource-dir
/home/vegard/llvm-build/lib/clang/7.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++ -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/backward
-internal-isystem /usr/local/include -internal-isystem
/home/vegard/llvm-build/lib/clang/7.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/vegard/creduce -ferror-limit 19 -fmessage-length
207 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o -.o -x c++ - 
1.      <eof> parser at end of file
2.      <stdin>:4:6: LLVM IR generation of declaration 'fn1'
3.      <stdin>:4:6: Generating code for declaration 'fn1'
#0 0x0000000008da8742 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/vegard/llvm/lib/Support/Unix/Signals.inc:403:0
#1 0x0000000008d9e6f2 llvm::sys::RunSignalHandlers()
/home/vegard/llvm/lib/Support/Signals.cpp:50:0
#2 0x0000000008d9eea9 SignalHandler(int)
/home/vegard/llvm/lib/Support/Unix/Signals.inc:243:0
#3 0x00007f4870286390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f486eff1428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f486eff302a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f486efe9bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#7 0x00007f486efe9c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x000000000717cb63 bool llvm::DenseMapBase<llvm::DenseMap<unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*> >, unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*>
>::LookupBucketFor<unsigned int>(unsigned int const&,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*> const*&) const
/home/vegard/llvm/lib/IR/Type.cpp:241:0
#9 0x000000000717cb63 bool llvm::DenseMapBase<llvm::DenseMap<unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*> >, unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*>
>::LookupBucketFor<unsigned int>(unsigned int const&,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*>*&)
/home/vegard/llvm/include/llvm/ADT/DenseMap.h:627:0
#10 0x000000000717cb63 llvm::DenseMapBase<llvm::DenseMap<unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*> >, unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*>
>::FindAndConstruct(unsigned int const&)
/home/vegard/llvm/include/llvm/ADT/DenseMap.h:289:0
#11 0x000000000717cb63 llvm::DenseMapBase<llvm::DenseMap<unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*> >, unsigned int,
llvm::IntegerType*, llvm::DenseMapInfo<unsigned int>,
llvm::detail::DenseMapPair<unsigned int, llvm::IntegerType*>
>::operator[](unsigned int const&)
/home/vegard/llvm/include/llvm/ADT/DenseMap.h:296:0
#12 0x000000000717cb63 llvm::IntegerType::get(llvm::LLVMContext&, unsigned int)
/home/vegard/llvm/lib/IR/Type.cpp:256:0
#13 0x00000000099e64c0 bitsToCharUnits
/home/vegard/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:147:0
#14 0x00000000099e64c0 accumulateBitFields
/home/vegard/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:469:0
#15 0x00000000099e64c0 (anonymous
namespace)::CGRecordLowering::accumulateFields() (.constprop.287)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:357:0
#16 0x00000000099f9784 (anonymous namespace)::CGRecordLowering::lower(bool)
(.constprop.285)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:269:0
#17 0x0000000009a0675e llvm::isa_impl_cl<clang::CXXRecordDecl,
clang::RecordDecl const*>::doit(clang::RecordDecl const*)
/home/vegard/llvm/include/llvm/Support/Casting.h:106:0
#18 0x0000000009a0675e llvm::isa_impl_wrap<clang::CXXRecordDecl,
clang::RecordDecl const*, clang::RecordDecl const*>::doit(clang::RecordDecl
const* const&) /home/vegard/llvm/include/llvm/Support/Casting.h:133:0
#19 0x0000000009a0675e llvm::isa_impl_wrap<clang::CXXRecordDecl,
clang::RecordDecl const* const, clang::RecordDecl
const*>::doit(clang::RecordDecl const* const&)
/home/vegard/llvm/include/llvm/Support/Casting.h:125:0
#20 0x0000000009a0675e bool llvm::isa<clang::CXXRecordDecl, clang::RecordDecl
const*>(clang::RecordDecl const* const&)
/home/vegard/llvm/include/llvm/Support/Casting.h:144:0
#21 0x0000000009a0675e
clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
llvm::StructType*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:730:0
#22 0x0000000009e33d6e
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:710:0
#23 0x0000000009e499bb
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:390:0
#24 0x0000000009e52d27
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:91:0
#25 0x000000000a34ce43
clang::CodeGen::CodeGenFunction::CreateMemTemp(clang::QualType,
clang::CharUnits, llvm::Twine const&, bool)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:138:0
#26 0x000000000a34cee0
clang::CodeGen::CodeGenFunction::CreateMemTemp(clang::QualType, llvm::Twine
const&, bool) /home/vegard/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:132:0
#27 0x000000000a3acabd
clang::CodeGen::AggValueSlot::forAddr(clang::CodeGen::Address,
clang::Qualifiers, clang::CodeGen::AggValueSlot::IsDestructed_t,
clang::CodeGen::AggValueSlot::NeedsGCBarriers_t,
clang::CodeGen::AggValueSlot::IsAliased_t,
clang::CodeGen::AggValueSlot::Overlap_t,
clang::CodeGen::AggValueSlot::IsZeroed_t)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGValue.h:516:0
#28 0x000000000a3acabd
clang::CodeGen::CodeGenFunction::CreateAggTemp(clang::QualType, llvm::Twine
const&) /home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h:2081:0
#29 0x00000000009f7927 (anonymous
namespace)::AggExprEmitter::EnsureSlot(clang::QualType)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp:43:0
#30 0x00000000009f7a60 (anonymous
namespace)::AggExprEmitter::VisitCXXConstructExpr(clang::CXXConstructExpr
const*) /home/vegard/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp:1101:0
#31 0x000000000a3c0dd7 VisitCXXTemporaryObjectExpr
/home/vegard/llvm-build/tools/clang/include/clang/AST/StmtNodes.inc:217:0
#32 0x000000000a3c0dd7 Visit
/home/vegard/llvm-build/tools/clang/include/clang/AST/StmtNodes.inc:217:0
#33 0x000000000a3c0dd7 (anonymous
namespace)::AggExprEmitter::Visit(clang::Expr*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp:105:0
#34 0x000000000a3c52c7 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp:1633:0
#35 0x000000000a34d933 clang::CodeGen::AggValueSlot::asRValue() const
/home/vegard/llvm/tools/clang/lib/CodeGen/CGValue.h:590:0
#36 0x000000000a34d933 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:185:0
#37 0x000000000a38676d
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:163:0
#38 0x0000000009a3c473 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:116:0
#39 0x0000000009a40762
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/home/vegard/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:389:0
#40 0x0000000009b7a030
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1195:0
#41 0x0000000009bc45be
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1360:0
#42 0x0000000009c91821
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3635:0
#43 0x0000000009d166f7
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2300:0
#44 0x0000000009d1ce89
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2077:0
#45 0x0000000009d21df7
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(.part.6256.constprop.6262)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:4373:0
#46 0x000000000c0365ab (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/home/vegard/llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:159:0
#47 0x000000000c0215f5
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:170:0
#48 0x000000000e9bab95 clang::ParseAST(clang::Sema&, bool, bool)
/home/vegard/llvm/tools/clang/lib/Parse/ParseAST.cpp:156:0
#49 0x000000000c01df2c clang::CodeGenAction::ExecuteAction()
/home/vegard/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1044:0
#50 0x000000000aecb7d6 clang::FrontendAction::Execute()
/home/vegard/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:904:0
#51 0x000000000ad5d2c8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/vegard/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:990:0
#52 0x000000000b2dc498
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/vegard/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:256:0
#53 0x0000000000e993f8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/vegard/llvm/tools/clang/tools/driver/cc1_main.cpp:222:0
#54 0x0000000000de2539 ExecuteCC1Tool
/home/vegard/llvm/tools/clang/tools/driver/driver.cpp:310:0
#55 0x0000000000de2539 main
/home/vegard/llvm/tools/clang/tools/driver/driver.cpp:382:0
#56 0x00007f486efdc830 __libc_start_main
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#57 0x0000000000e7e1f9 _start (/home/vegard/llvm-build/bin/clang-7+0xe7e1f9)
clang-7: error: unable to execute command: Aborted
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (https://github.com/llvm-mirror/clang
fd84b47426fa82c78ca25ba20cf37fc9b0f42586) (https://github.com/llvm-mirror/llvm
e1b4442d3ffc378f4a48dd0bfeb2b0876b116e2f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/vegard/llvm-build/bin

Looks similar to bug #26169 and bug #28653, but the test case looks different
enough that I'm filing a new bug.

-- 
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/20180508/3ff7b803/attachment-0001.html>


More information about the llvm-bugs mailing list