[llvm-bugs] [Bug 50869] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu: Assertion `cast<PointerType>(Ptr->getType()->getScalarType()) ->isOpaqueOrPointeeTypeMatches(PointeeType)' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jun 25 12:53:21 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50869
Bug ID: 50869
Summary: clang crashes on valid code at -O1 and above on
x86_64-linux-gnu: Assertion
`cast<PointerType>(Ptr->getType()->getScalarType())
->isOpaqueOrPointeeTypeMatches(PointeeType)' failed
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: zhendong.su at inf.ethz.ch
CC: llvm-bugs at lists.llvm.org
[640] % clangtk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
c9acd2f32e6b4c10f6b1b94acb3418e47d645a7a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
[641] %
[641] % clangtk -O0 small.c; ./a.out
[642] %
[642] % clangtk -O1 small.c
clang-13:
/local/suz-local/software/clangbuild/llvm-project/llvm/include/llvm/IR/Instructions.h:968:
static llvm::GetElementPtrInst* llvm::GetElementPtrInst::Create(llvm::Type*,
llvm::Value*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&,
llvm::Instruction*): Assertion
`cast<PointerType>(Ptr->getType()->getScalarType())
->isOpaqueOrPointeeTypeMatches(PointeeType)' 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:
/local/suz-local/software/local/clang-trunk/bin/clang-13 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free
-main-file-name small.c -mrelocation-model static -mframe-pointer=none
-fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb
-fcoverage-compilation-dir=/local/suz-local/software/emitesting/bugs/20210625-clangtk-m64-O1-Weverything-pipe-fPIC-build-164439/delta
-resource-dir /local/suz-local/software/local/clang-trunk/lib/clang/13.0.0 -I
/usr/local/include/csmith -internal-isystem
/local/suz-local/software/local/clang-trunk/lib/clang/13.0.0/include
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-fdebug-compilation-dir=/local/suz-local/software/emitesting/bugs/20210625-clangtk-m64-O1-Weverything-pipe-fPIC-build-164439/delta
-ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig
-D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-a0a132.o -x c small.c
1. <eof> parser at end of file
2. Optimizer
#0 0x000055bd9f3f053f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000055bd9f3edd8d SignalHandler(int) Signals.cpp:0:0
#2 0x00007fc1a367f980 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#3 0x00007fc1a2330fb7 raise
/build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#4 0x00007fc1a2332921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
#5 0x00007fc1a232248a __assert_fail_base
/build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
#6 0x00007fc1a2322502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#7 0x000055bd9ee59c0b rewriteGEPAsOffset(llvm::Type*, llvm::Value*,
llvm::Value*, llvm::DataLayout const&, llvm::SetVector<llvm::Value*,
std::vector<llvm::Value*, std::allocator<llvm::Value*> >,
llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*> > >&)
InstCombineCompares.cpp:0:0
#8 0x000055bd9ee5b1cd transformToIndexedCompare(llvm::GEPOperator*,
llvm::Value*, llvm::CmpInst::Predicate, llvm::DataLayout const&)
InstCombineCompares.cpp:0:0
#9 0x000055bd9ee5b5e0 llvm::InstCombinerImpl::foldGEPICmp(llvm::GEPOperator*,
llvm::Value*, llvm::CmpInst::Predicate, llvm::Instruction&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x32575e0)
#10 0x000055bd9ee682e0 llvm::InstCombinerImpl::visitICmpInst(llvm::ICmpInst&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x32642e0)
#11 0x000055bd9edf70f9 llvm::InstCombinerImpl::run()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x31f30f9)
#12 0x000055bd9edf93ec combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&,
llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*,
llvm::ProfileSummaryInfo*, unsigned int, llvm::LoopInfo*)
InstructionCombining.cpp:0:0
#13 0x000055bd9edfa498 llvm::InstCombinePass::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x31f6498)
#14 0x000055bda041f561 llvm::detail::PassModel<llvm::Function,
llvm::InstCombinePass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x481b561)
#15 0x000055bd9ebef9bc llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2feb9bc)
#16 0x000055bd9d225641 llvm::detail::PassModel<llvm::Function,
llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>
>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x1621641)
#17 0x000055bd9ebef2a4 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2feb2a4)
#18 0x000055bd9d225de1 llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x1621de1)
#19 0x000055bd9ebeda64 llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2fe9a64)
#20 0x000055bd9f6da994 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#21 0x000055bd9f6df943 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3adb943)
#22 0x000055bda03a386a
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x479f86a)
#23 0x000055bda1270949 clang::ParseAST(clang::Sema&, bool, bool)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x566c949)
#24 0x000055bda03a3a08 clang::CodeGenAction::ExecuteAction()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x479fa08)
#25 0x000055bd9fd00c31 clang::FrontendAction::Execute()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x40fcc31)
#26 0x000055bd9fc9d27a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x409927a)
#27 0x000055bd9fdcf0aa
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x41cb0aa)
#28 0x000055bd9cf9eb7c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/local/suz-local/software/local/clang-trunk/bin/clang-13+0x139ab7c)
#29 0x000055bd9cf99f29 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#30 0x000055bd9cec5df7 main
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x12c1df7)
#31 0x00007fc1a2313bf7 __libc_start_main
/build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#32 0x000055bd9cf99a9a _start
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x1395a9a)
clang-13: error: unable to execute command: Aborted
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
c9acd2f32e6b4c10f6b1b94acb3418e47d645a7a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/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/small-e0b3d5.c
clang-13: note: diagnostic msg: /tmp/small-e0b3d5.sh
clang-13: note: diagnostic msg:
********************
[643] %
[643] % cat small.c
int b, c, d, e, f, g, h, i, j, k, l, m;
int main() {
int o[2], *p = &o[1];
while (b) {
if (b)
break;
goto L1;
}
if (h)
L2:;
while (e) {
int s = 2;
L3:
if (d)
L1:
while (d) {
if (g)
goto L3;
goto L2;
}
while (d)
while (j) {
int u;
if (f) {
int v;
if (i) {
int w;
if (b) {
if (l)
break;
int x;
if (*p) {
if (!s) {
int **a = &p;
*a = &m;
}
b = k;
}
}
}
}
}
}
b = p == &o[1] || b || c;
return 0;
}
--
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/20210625/a93bdfcd/attachment-0001.html>
More information about the llvm-bugs
mailing list