[llvm-bugs] [Bug 50833] New: ICE: llvm-project/clang/lib/Analysis/CFG.cpp:3399: clang::CFGBlock* {anonymous}::CFGBuilder::VisitForStmt(clang::ForStmt*): Assertion `Block == Succ' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 23 20:01:07 PDT 2021


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

            Bug ID: 50833
           Summary: ICE: llvm-project/clang/lib/Analysis/CFG.cpp:3399:
                    clang::CFGBlock*
                    {anonymous}::CFGBuilder::VisitForStmt(clang::ForStmt*)
                    : Assertion `Block == Succ' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cnsun at uwaterloo.ca
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

clang-10 does not crash.


$ clang-trunk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
5c8659801a4976ef2b327f4071d98086efd42a36)
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
break_continue_in_increment() {
  for (;; ({ continue; }))
    ;
}

$ clang-trunk  mutant.c
mutant.c:1:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
break_continue_in_increment() {
^
clang-13:
/tmp/tmp.FIfHBNID2p-clang-builder/llvm-project/clang/lib/Analysis/CFG.cpp:3399:
clang::CFGBlock* {anonymous}::CFGBuilder::VisitForStmt(clang::ForStmt*):
Assertion `Block == Succ' 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/default_c_finding_folder/crash_20210623_044612_0037/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
-fdebug-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/default_c_finding_folder/crash_20210623_044612_0037/delta/perses_result
-ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1
-o /tmp/mutant-c1b3f0.o -x c mutant.c
1.      <eof> parser at end of file
2.      mutant.c:1:31: parsing function body 'break_continue_in_increment'
 #0 0x0000563abc2c6c64 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000563abc2c441e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fd914d433c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007fd9147e218b raise
/build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007fd9147c1859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007fd9147c1729 get_sysdep_segment_value
/build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007fd9147c1729 _nl_load_domain
/build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007fd9147d2f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x0000563abf013f83 (anonymous
namespace)::CFGBuilder::VisitForStmt(clang::ForStmt*) CFG.cpp:0:0
 #9 0x0000563abf011aab (anonymous namespace)::CFGBuilder::Visit(clang::Stmt*,
(anonymous namespace)::AddStmtChoice, bool) CFG.cpp:0:0
#10 0x0000563abf0175dd (anonymous
namespace)::CFGBuilder::VisitCompoundStmt(clang::CompoundStmt*, bool)
CFG.cpp:0:0
#11 0x0000563abf011137 (anonymous namespace)::CFGBuilder::Visit(clang::Stmt*,
(anonymous namespace)::AddStmtChoice, bool) CFG.cpp:0:0
#12 0x0000563abf018be7 clang::CFG::buildCFG(clang::Decl const*, clang::Stmt*,
clang::ASTContext*, clang::CFG::BuildOptions const&)
(/scratch/software/clang-trunk/bin/clang-13+0x66a0be7)
#13 0x0000563abefc2810 clang::AnalysisDeclContext::getCFG()
(/scratch/software/clang-trunk/bin/clang-13+0x664a810)
#14 0x0000563abef253b8 CheckFallThroughForBody(clang::Sema&, clang::Decl
const*, clang::Stmt const*, clang::QualType, (anonymous
namespace)::CheckFallThroughDiagnostics const&, clang::AnalysisDeclContext&,
clang::sema::FunctionScopeInfo*) AnalysisBasedWarnings.cpp:0:0
#15 0x0000563abef35257
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType)
(/scratch/software/clang-trunk/bin/clang-13+0x65bd257)
#16 0x0000563abe60e346
clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy
const*, clang::Decl const*, clang::QualType)
(/scratch/software/clang-trunk/bin/clang-13+0x5c96346)
#17 0x0000563abe7aa12b clang::Sema::ActOnFinishFunctionBody(clang::Decl*,
clang::Stmt*, bool) (/scratch/software/clang-trunk/bin/clang-13+0x5e3212b)
#18 0x0000563abe59f97d clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/scratch/software/clang-trunk/bin/clang-13+0x5c2797d)
#19 0x0000563abe4e5c22
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/scratch/software/clang-trunk/bin/clang-13+0x5b6dc22)
#20 0x0000563abe512580 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/scratch/software/clang-trunk/bin/clang-13+0x5b9a580)
#21 0x0000563abe4e0426
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/scratch/software/clang-trunk/bin/clang-13+0x5b68426)
#22 0x0000563abe4e0a11
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#23 0x0000563abe4e7217
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/scratch/software/clang-trunk/bin/clang-13+0x5b6f217)
#24 0x0000563abe4e87ae
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5b707ae)
#25 0x0000563abe4e8b59
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/scratch/software/clang-trunk/bin/clang-13+0x5b70b59)
#26 0x0000563abe4dafca clang::ParseAST(clang::Sema&, bool, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5b62fca)
#27 0x0000563abd422678 clang::CodeGenAction::ExecuteAction()
(/scratch/software/clang-trunk/bin/clang-13+0x4aaa678)
#28 0x0000563abccd2029 clang::FrontendAction::Execute()
(/scratch/software/clang-trunk/bin/clang-13+0x435a029)
#29 0x0000563abcc651e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/scratch/software/clang-trunk/bin/clang-13+0x42ed1e6)
#30 0x0000563abcdafeb0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/scratch/software/clang-trunk/bin/clang-13+0x4437eb0)
#31 0x0000563ab9bd86f6 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/scratch/software/clang-trunk/bin/clang-13+0x12606f6)
#32 0x0000563ab9bd4a38 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#33 0x0000563ab9b020a6 main
(/scratch/software/clang-trunk/bin/clang-13+0x118a0a6)
#34 0x00007fd9147c30b3 __libc_start_main
/build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#35 0x0000563ab9bd45ae _start
(/scratch/software/clang-trunk/bin/clang-13+0x125c5ae)
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
5c8659801a4976ef2b327f4071d98086efd42a36)
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-152700.c
clang-13: note: diagnostic msg: /tmp/mutant-152700.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/20210624/27c19acc/attachment-0001.html>


More information about the llvm-bugs mailing list