[llvm-bugs] [Bug 50367] New: clang crashes on valid code at -O1, -Os and -O2 (but not -O3) on x86_64-linux-gnu: Assertion `Val && "isa<> used on a null pointer"' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun May 16 12:38:32 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50367
Bug ID: 50367
Summary: clang crashes on valid code at -O1, -Os and -O2 (but
not -O3) on x86_64-linux-gnu: Assertion `Val && "isa<>
used on a null pointer"' failed
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Support Libraries
Assignee: unassignedbugs at nondot.org
Reporter: zhendong.su at inf.ethz.ch
CC: llvm-bugs at lists.llvm.org
[622] % clangtk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
d1a7630369bc489ca85e7fd0e05119a6d6f09039)
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
[623] %
[623] % clangtk -O0 small.c
[624] %
[624] % clangtk -O1 small.c
clang-13:
/local/suz-local/software/clangbuild/llvm-project/llvm/include/llvm/Support/Casting.h:104:
static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To =
llvm::Instruction; From = llvm::Value]: Assertion `Val && "isa<> used on a null
pointer"' 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/20210516-clangtk-m64-O3-build-195623/delta
-resource-dir /local/suz-local/software/local/clang-trunk/lib/clang/13.0.0
-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/20210516-clangtk-m64-O3-build-195623/delta
-ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig
-D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-2c4caa.o -x c small.c
1. <eof> parser at end of file
2. Optimizer
#0 0x000055cbed7e0eac llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3738eac)
#1 0x000055cbed7ded64 llvm::sys::RunSignalHandlers()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3736d64)
#2 0x000055cbed7deed3 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f0cd697c980 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007f0cd562dfb7 raise
/build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f0cd562f921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f0cd561f48a __assert_fail_base
/build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
#7 0x00007f0cd561f502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#8 0x000055cbeb270340 llvm::DenseMapIterator<llvm::BasicBlock const*,
llvm::Loop*, llvm::DenseMapInfo<llvm::BasicBlock const*>,
llvm::detail::DenseMapPair<llvm::BasicBlock const*, llvm::Loop*>,
true>::AdvancePastEmptyBuckets() (.isra.221.part.222) LoopInfo.cpp:0:0
#9 0x000055cbec87239f
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x27ca39f)
#10 0x000055cbed55dc04 collectPromotionCandidates(llvm::MemorySSA*,
llvm::AAResults*, llvm::Loop*,
llvm::SmallVectorImpl<llvm::Instruction*>&)::'lambda0'(llvm::Instruction*)::operator()(llvm::Instruction*)
const LICM.cpp:0:0
#11 0x000055cbed56db2f (anonymous
namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::BlockFrequencyInfo*,
llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*, llvm::ScalarEvolution*,
llvm::MemorySSA*, llvm::OptimizationRemarkEmitter*) (.part.834) LICM.cpp:0:0
#12 0x000055cbed56e9ee llvm::LICMPass::run(llvm::Loop&,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x34c69ee)
#13 0x000055cbee90bbc1 llvm::detail::PassModel<llvm::Loop, llvm::LICMPass,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Loop,
llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&,
llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop,
llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&,
llvm::LPMUpdater&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x4863bc1)
#14 0x000055cbeea4735e llvm::Optional<llvm::PreservedAnalyses>
llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop,
llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&,
llvm::LPMUpdater&>::runSinglePass<llvm::Loop,
std::unique_ptr<llvm::detail::PassConcept<llvm::Loop,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>,
std::default_delete<llvm::detail::PassConcept<llvm::Loop,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&> > > >(llvm::Loop&,
std::unique_ptr<llvm::detail::PassConcept<llvm::Loop,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>,
std::default_delete<llvm::detail::PassConcept<llvm::Loop,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&> > >&,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&,
llvm::PassInstrumentation&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x499f35e)
#15 0x000055cbeea475ce llvm::PassManager<llvm::Loop,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>,
llvm::LoopStandardAnalysisResults&,
llvm::LPMUpdater&>::runWithoutLoopNestPasses(llvm::Loop&,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x499f5ce)
#16 0x000055cbeea488b8 llvm::PassManager<llvm::Loop,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&,
llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&,
llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x49a08b8)
#17 0x000055cbeea4a1a9 llvm::FunctionToLoopPassAdaptor::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x49a21a9)
#18 0x000055cbee7c11f1 llvm::detail::PassModel<llvm::Function,
llvm::FunctionToLoopPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x47191f1)
#19 0x000055cbed019ecc 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+0x2f71ecc)
#20 0x000055cbeb6c6e61 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+0x161ee61)
#21 0x000055cbec7a133c
llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x26f933c)
#22 0x000055cbeb6c7941 llvm::detail::PassModel<llvm::LazyCallGraph::SCC,
llvm::CGSCCToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x161f941)
#23 0x000055cbec79a153 llvm::PassManager<llvm::LazyCallGraph::SCC,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x26f2153)
#24 0x000055cbed110ad1 llvm::detail::PassModel<llvm::LazyCallGraph::SCC,
llvm::PassManager<llvm::LazyCallGraph::SCC,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3068ad1)
#25 0x000055cbec79d688
llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x26f5688)
#26 0x000055cbed110a91 llvm::detail::PassModel<llvm::LazyCallGraph::SCC,
llvm::DevirtSCCRepeatedPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&,
llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&,
llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3068a91)
#27 0x000055cbec79bb9f
llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x26f3b9f)
#28 0x000055cbed110b11 llvm::detail::PassModel<llvm::Module,
llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3068b11)
#29 0x000055cbed017f74 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+0x2f6ff74)
#30 0x000055cbed113183 llvm::ModuleInlinerWrapperPass::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x306b183)
#31 0x000055cbee7c1471 llvm::detail::PassModel<llvm::Module,
llvm::ModuleInlinerWrapperPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x4719471)
#32 0x000055cbed017f74 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+0x2f6ff74)
#33 0x000055cbedab4337 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#34 0x000055cbedab9253 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+0x3a11253)
#35 0x000055cbee748aaa
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x46a0aaa)
#36 0x000055cbef5ab3e9 clang::ParseAST(clang::Sema&, bool, bool)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x55033e9)
#37 0x000055cbee748c48 clang::CodeGenAction::ExecuteAction()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x46a0c48)
#38 0x000055cbee0cdc41 clang::FrontendAction::Execute()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x4025c41)
#39 0x000055cbee069a92
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3fc1a92)
#40 0x000055cbee1994ca
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x40f14ca)
#41 0x000055cbeb44a6fc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/local/suz-local/software/local/clang-trunk/bin/clang-13+0x13a26fc)
#42 0x000055cbeb4459b9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#43 0x000055cbeb372bb7 main
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x12cabb7)
#44 0x00007f0cd5610bf7 __libc_start_main
/build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#45 0x000055cbeb44552a _start
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x139d52a)
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
d1a7630369bc489ca85e7fd0e05119a6d6f09039)
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-cf5a42.c
clang-13: note: diagnostic msg: /tmp/small-cf5a42.sh
clang-13: note: diagnostic msg:
********************
[625] %
[625] % cat small.c
int a (int b) { return b; }
int c, d, *e = &d;
int main() {
for (; *e; (*e)++)
for (c = 0; c < 1; c++) {
if (a(1))
e = 0;
if (d)
*e = 0;
}
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/20210516/d8d9e27d/attachment-0001.html>
More information about the llvm-bugs
mailing list