[llvm-bugs] [Bug 50900] New: ICE: UNREACHABLE executed at llvm-project/clang/lib/AST/StmtPrinter.cpp:2537!

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 26 14:49:39 PDT 2021


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

            Bug ID: 50900
           Summary: ICE: UNREACHABLE executed at
                    llvm-project/clang/lib/AST/StmtPrinter.cpp:2537!
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            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
2e9c75daffddd65e37c3236708b5b133e6f5f2f5)
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
struct {
  char name;
} cnvNameType[] = {"bocu1"};
getAlgorithmicTypeFromName() { sizeof cnvNameType / sizeof svptest_any(pg); }

$ clang-trunk  mutant.c
mutant.c:3:20: warning: incompatible pointer to integer conversion initializing
'char' with an expression of type 'char [6]' [-Wint-conversion]
} cnvNameType[] = {"bocu1"};
                   ^~~~~~~
mutant.c:3:20: error: initializer element is not a compile-time constant
} cnvNameType[] = {"bocu1"};
                   ^~~~~~~
mutant.c:4:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
getAlgorithmicTypeFromName() { sizeof cnvNameType / sizeof svptest_any(pg); }
^
mutant.c:4:60: warning: implicit declaration of function 'svptest_any' is
invalid in C99 [-Wimplicit-function-declaration]
getAlgorithmicTypeFromName() { sizeof cnvNameType / sizeof svptest_any(pg); }
                                                           ^
mutant.c:4:51: warning: expression does not compute the number of elements in
this array; element type is 'struct (unnamed struct at mutant.c:1:1)', not
'int' [-Wsizeof-array-div]
getAlgorithmicTypeFromName() { sizeof cnvNameType / sizeof svptest_any(pg); }
                                      ~~~~~~~~~~~ ^
mutant.c:3:3: note: array 'cnvNameType' declared here
} cnvNameType[] = {"bocu1"};
  ^
Cannot print TypoExpr nodes
UNREACHABLE executed at
/tmp/tmp.xjN6dMkdrg-clang-builder/llvm-project/clang/lib/AST/StmtPrinter.cpp:2537!
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_20210624_082150_02a0/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_20210624_082150_02a0/delta/perses_result
-ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1
-o /tmp/mutant-a2c849.o -x c mutant.c
1.      mutant.c:4:75: current parser token ';'
2.      mutant.c:4:30: parsing function body 'getAlgorithmicTypeFromName'
3.      mutant.c:4:30: in compound statement ('{}')
 #0 0x000055b53c073184 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055b53c07093e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f134515e3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007f1344bfd18b raise
/build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007f1344bdc859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
 #5 0x000055b53bfbf65e (/scratch/software/clang-trunk/bin/clang-13+0x38a765e)
 #6 0x000055b53f305129 (anonymous namespace)::StmtPrinter::Visit(clang::Stmt*)
StmtPrinter.cpp:0:0
 #7 0x000055b53f30d368 (anonymous
namespace)::StmtPrinter::PrintCallArgs(clang::CallExpr*) StmtPrinter.cpp:0:0
 #8 0x000055b53f30d538 (anonymous
namespace)::StmtPrinter::VisitCallExpr(clang::CallExpr*) StmtPrinter.cpp:0:0
 #9 0x000055b53f303da6 (anonymous namespace)::StmtPrinter::Visit(clang::Stmt*)
StmtPrinter.cpp:0:0
#10 0x000055b53f3114cc (anonymous
namespace)::StmtPrinter::VisitUnaryExprOrTypeTraitExpr(clang::UnaryExprOrTypeTraitExpr*)
StmtPrinter.cpp:0:0
#11 0x000055b53f304946 (anonymous namespace)::StmtPrinter::Visit(clang::Stmt*)
StmtPrinter.cpp:0:0
#12 0x000055b53f30571b clang::Stmt::printPretty(llvm::raw_ostream&,
clang::PrinterHelper*, clang::PrintingPolicy const&, unsigned int,
llvm::StringRef, clang::ASTContext const*) const
(/scratch/software/clang-trunk/bin/clang-13+0x6bed71b)
#13 0x000055b53f31dee9 clang::StreamingDiagnostic const&
DiagTemplateArg<clang::StreamingDiagnostic>(clang::StreamingDiagnostic const&,
clang::TemplateArgument const&) TemplateBase.cpp:0:0
#14 0x000055b53e4defe4 clang::Sema::SemaDiagnosticBuilder const&
clang::operator<<<clang::Expr*>(clang::Sema::SemaDiagnosticBuilder const&,
clang::Expr* const&) (/scratch/software/clang-trunk/bin/clang-13+0x5dc6fe4)
#15 0x000055b53e6ddc57 DiagnoseDivisionSizeofPointerOrArray(clang::Sema&,
clang::Expr*, clang::Expr*, clang::SourceLocation) SemaExpr.cpp:0:0
#16 0x000055b53e724a3e
clang::Sema::CheckMultiplyDivideOperands(clang::ActionResult<clang::Expr*,
true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, bool,
bool) (/scratch/software/clang-trunk/bin/clang-13+0x600ca3e)
#17 0x000055b53e72cfef clang::Sema::CreateBuiltinBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/scratch/software/clang-trunk/bin/clang-13+0x6014fef)
#18 0x000055b53e72de14 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/scratch/software/clang-trunk/bin/clang-13+0x6015e14)
#19 0x000055b53e72e2b1 clang::Sema::ActOnBinOp(clang::Scope*,
clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*)
(/scratch/software/clang-trunk/bin/clang-13+0x60162b1)
#20 0x000055b53e2e7aaf
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level)
(/scratch/software/clang-trunk/bin/clang-13+0x5bcfaaf)
#21 0x000055b53e2e9b0d
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/scratch/software/clang-trunk/bin/clang-13+0x5bd1b0d)
#22 0x000055b53e35174e
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/scratch/software/clang-trunk/bin/clang-13+0x5c3974e)
#23 0x000055b53e348ce2
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::ParsedAttributesWithRange&)
(/scratch/software/clang-trunk/bin/clang-13+0x5c30ce2)
#24 0x000055b53e3496ca
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/scratch/software/clang-trunk/bin/clang-13+0x5c316ca)
#25 0x000055b53e34a649 clang::Parser::ParseCompoundStatementBody(bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5c32649)
#26 0x000055b53e34cc5a clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/scratch/software/clang-trunk/bin/clang-13+0x5c34c5a)
#27 0x000055b53e292ef2
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/scratch/software/clang-trunk/bin/clang-13+0x5b7aef2)
#28 0x000055b53e2bf850 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/scratch/software/clang-trunk/bin/clang-13+0x5ba7850)
#29 0x000055b53e28d6f6
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/scratch/software/clang-trunk/bin/clang-13+0x5b756f6)
#30 0x000055b53e28dce1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#31 0x000055b53e2944e7
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/scratch/software/clang-trunk/bin/clang-13+0x5b7c4e7)
#32 0x000055b53e295a7e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5b7da7e)
#33 0x000055b53e2882c9 clang::ParseAST(clang::Sema&, bool, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5b702c9)
#34 0x000055b53d1cf968 clang::CodeGenAction::ExecuteAction()
(/scratch/software/clang-trunk/bin/clang-13+0x4ab7968)
#35 0x000055b53ca7f599 clang::FrontendAction::Execute()
(/scratch/software/clang-trunk/bin/clang-13+0x4367599)
#36 0x000055b53ca127e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/scratch/software/clang-trunk/bin/clang-13+0x42fa7e6)
#37 0x000055b53cb5d480
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/scratch/software/clang-trunk/bin/clang-13+0x4445480)
#38 0x000055b53997d696 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/scratch/software/clang-trunk/bin/clang-13+0x1265696)
#39 0x000055b5399799d8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#40 0x000055b5398a70e6 main
(/scratch/software/clang-trunk/bin/clang-13+0x118f0e6)
#41 0x00007f1344bde0b3 __libc_start_main
/build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#42 0x000055b53997954e _start
(/scratch/software/clang-trunk/bin/clang-13+0x126154e)
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
2e9c75daffddd65e37c3236708b5b133e6f5f2f5)
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-b99b71.c
clang-13: note: diagnostic msg: /tmp/mutant-b99b71.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/20210626/85f8d6a6/attachment.html>


More information about the llvm-bugs mailing list