[llvm-bugs] [Bug 51119] New: ICE on compilable code: llvm::APInt llvm::APInt::udiv(const llvm::APInt&) const: Assertion `rhsWords && "Divided by zero???"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 16 13:52:12 PDT 2021


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

            Bug ID: 51119
           Summary: ICE on compilable code: llvm::APInt
                    llvm::APInt::udiv(const llvm::APInt&) const: Assertion
                    `rhsWords && "Divided by zero???"' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cnsun at uwaterloo.ca
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

$ clang-trunk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
7139497656147275156e7242a8bf08794af9130a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ cat mutant.c
foo() { foo + ((__uint128_t)123456 << 64); }

$ clang-trunk -w mutant.c
clang-13:
/tmp/tmp.yXrVH9VfkV-clang-builder/llvm-project/llvm/lib/Support/APInt.cpp:1617:
llvm::APInt llvm::APInt::udiv(const llvm::APInt&) const: Assertion `rhsWords &&
"Divided by zero???"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /scratch/software/clang-trunk/bin/clang-13 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations
-disable-free -main-file-name mutant.c -mrelocation-model static
-mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb
-fcoverage-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/temp_testing_campaigns/default_finding_folder_c/crash_20210708_073919_2560/delta/perses_result
-resource-dir /scratch/software/clang-trunk/lib/clang/13.0.0 -c-isystem .
-c-isystem /usr/local/include/cmsith -internal-isystem
/scratch/software/clang-trunk/lib/clang/13.0.0/include -internal-isystem
/usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -w
-fdebug-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/temp_testing_campaigns/default_finding_folder_c/crash_20210708_073919_2560/delta/perses_result
-ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1
-o /tmp/mutant-a78f7a.o -x c mutant.c
1.      mutant.c:1:42: current parser token ';'
2.      mutant.c:1:7: parsing function body 'foo'
3.      mutant.c:1:7: in compound statement ('{}')
 #0 0x00005599325c3034 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00005599325c07ee SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f2d775433c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007f2d76fe218b raise
/build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007f2d76fc1859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007f2d76fc1729 get_sysdep_segment_value
/build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007f2d76fc1729 _nl_load_domain
/build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007f2d76fd2f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x00005599324e40c4 (/scratch/software/clang-trunk/bin/clang-13+0x39110c4)
 #9 0x00005599349949b7 clang::Sema::CheckArrayAccess(clang::Expr const*,
clang::Expr const*, clang::ArraySubscriptExpr const*, bool, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5dc19b7)
#10 0x0000559934c99afe
clang::Sema::CheckAdditionOperands(clang::ActionResult<clang::Expr*, true>&,
clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation,
clang::BinaryOperatorKind, clang::QualType*)
(/scratch/software/clang-trunk/bin/clang-13+0x60c6afe)
#11 0x0000559934ca3217 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/scratch/software/clang-trunk/bin/clang-13+0x60d0217)
#12 0x0000559934ca4064 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/scratch/software/clang-trunk/bin/clang-13+0x60d1064)
#13 0x0000559934ca4501 clang::Sema::ActOnBinOp(clang::Scope*,
clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*)
(/scratch/software/clang-trunk/bin/clang-13+0x60d1501)
#14 0x000055993485d7af
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level)
(/scratch/software/clang-trunk/bin/clang-13+0x5c8a7af)
#15 0x000055993485f80d
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/scratch/software/clang-trunk/bin/clang-13+0x5c8c80d)
#16 0x00005599348c710e
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/scratch/software/clang-trunk/bin/clang-13+0x5cf410e)
#17 0x00005599348be702
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::ParsedAttributesWithRange&)
(/scratch/software/clang-trunk/bin/clang-13+0x5ceb702)
#18 0x00005599348bf0ea
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/scratch/software/clang-trunk/bin/clang-13+0x5cec0ea)
#19 0x00005599348c0069 clang::Parser::ParseCompoundStatementBody(bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5ced069)
#20 0x00005599348c261a clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/scratch/software/clang-trunk/bin/clang-13+0x5cef61a)
#21 0x00005599348084d2
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/scratch/software/clang-trunk/bin/clang-13+0x5c354d2)
#22 0x0000559934834e50 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/scratch/software/clang-trunk/bin/clang-13+0x5c61e50)
#23 0x0000559934802cb6
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/scratch/software/clang-trunk/bin/clang-13+0x5c2fcb6)
#24 0x00005599348032a1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#25 0x0000559934809ac7
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/scratch/software/clang-trunk/bin/clang-13+0x5c36ac7)
#26 0x000055993480b05e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5c3805e)
#27 0x000055993480b409
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/scratch/software/clang-trunk/bin/clang-13+0x5c38409)
#28 0x00005599347fd85a clang::ParseAST(clang::Sema&, bool, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5c2a85a)
#29 0x000055993373d1d8 clang::CodeGenAction::ExecuteAction()
(/scratch/software/clang-trunk/bin/clang-13+0x4b6a1d8)
#30 0x0000559932fdef69 clang::FrontendAction::Execute()
(/scratch/software/clang-trunk/bin/clang-13+0x440bf69)
#31 0x0000559932f71f76
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/scratch/software/clang-trunk/bin/clang-13+0x439ef76)
#32 0x00005599330bcdf0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/scratch/software/clang-trunk/bin/clang-13+0x44e9df0)
#33 0x000055992fe64b46 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/scratch/software/clang-trunk/bin/clang-13+0x1291b46)
#34 0x000055992fe60e88 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#35 0x000055992fd8e0e6 main
(/scratch/software/clang-trunk/bin/clang-13+0x11bb0e6)
#36 0x00007f2d76fc30b3 __libc_start_main
/build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#37 0x000055992fe609fe _start
(/scratch/software/clang-trunk/bin/clang-13+0x128d9fe)
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
7139497656147275156e7242a8bf08794af9130a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
clang-13: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/mutant-d038b0.c
clang-13: note: diagnostic msg: /tmp/mutant-d038b0.sh
clang-13: note: diagnostic msg:

********************

-- 
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/20210716/a4c9ed1a/attachment.html>


More information about the llvm-bugs mailing list