I do nightly builds of an open source project (VTK) with a clang I build myself and update every few weeks. After updating from r327520 to r338127 (and still with r338721 from yesterday), clang can no longer build VTK as it asserts with: ``` Assertion failed: (ExitIfTrue == L->contains(BI->getSuccessor(1)) && "It should have one successor in loop and one exit block!"), function computeExitLimit, file /Users/builder/llvm/llvm/lib/Analysis/ScalarEvolution.cpp, line 7088. Stack dump: 0. Program arguments: /Users/builder/llvm/llvm-rel-install/bin/clang-8 -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -disable-free -main-file-name V_GaussIntegration.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -faligned-alloc-unavailable -target-cpu penryn -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -target-linker-version 278.4 -coverage-notes-file /Users/builder/external/VTK-clang-dbg-x86_64/ThirdParty/verdict/vtkverdict/CMakeFiles/verdict.dir/V_GaussIntegration.cpp.gcno -resource-dir /Users/builder/llvm/llvm-rel-install/lib/clang/8.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -D VTK_IN_VTK -D verdict_EXPORTS -I /Users/builder/external/VTK-clang-dbg-x86_64/ThirdParty/verdict -I /Users/builder/external/VTK/ThirdParty/verdict -I /Users/builder/external/VTK-clang-dbg-x86_64/ThirdParty/verdict/vtkverdict -I /Users/builder/external/VTK/ThirdParty/verdict/vtkverdict -stdlib=libc++ -O1 -Weverything -Wno-padded -Wno-cast-align -Wno-covered-switch-default -Wno-long-long -Wno-float-equal -Wno-missing-noreturn -Wno-unused-macros -Wno-missing-variable-declarations -Wno-conversion -Wno-sign-conversion -Wundefined-bool-conversion -Wstring-conversion -Wno-undef -Wno-missing-prototypes -Wno-objc-interface-ivars -Wno-direct-ivar-access -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-double-promotion -Wno-extra-semi -Wno-exit-time-destructors -Wno-global-constructors -Wno-format-nonliteral -Wno-switch-enum -Wno-shorten-64-to-32 -Wno-weak-vtables -Wno-weak-template-vtables -Wno-missing-prototypes -Wno-disabled-macro-expansion -Wno-unused-member-function -Wno-vla -Wno-vla-extension -Wno-c++98-compat-pedantic -Wno-old-style-cast -Wno-undefined-func-template -Wno-inconsistent-missing-override -Wno-zero-as-null-pointer-constant -Wno-unused-template -Wno-shadow-field -Wno-deprecated-register -w -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/builder/external/VTK-clang-dbg-x86_64/ThirdParty/verdict/vtkverdict -ferror-limit 19 -fmessage-length 0 -fsanitize=array-bounds,bool,integer-divide-by-zero,null,object-size,return,shift-base,shift-exponent,unreachable,vla-bound,local-bounds -fsanitize-blacklist=/Users/builder/external/_scripts/builder14/_sanitize-blacklist.txt -fdepfile-entry=/Users/builder/external/_scripts/builder14/_sanitize-blacklist.txt -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.12.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/verdict.dir/V_GaussIntegration.cpp.o -x c++ /Users/builder/external/VTK/ThirdParty/verdict/vtkverdict/V_GaussIntegration.cpp 1. parser at end of file 2. Per-module optimization passes 3. Running pass 'CallGraph Pass Manager' on module '/Users/builder/external/VTK/ThirdParty/verdict/vtkverdict/V_GaussIntegration.cpp'. 4. Running pass 'Run-time bounds checking' on function '@_ZN16GaussIntegration31calculate_shape_function_3d_hexEv' 0 clang-8 0x0000000103e81368 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40 1 clang-8 0x0000000103e80525 llvm::sys::RunSignalHandlers() + 85 2 clang-8 0x0000000103e81972 SignalHandler(int) + 258 3 libsystem_platform.dylib 0x00007fffb2e2bb3a _sigtramp + 26 4 libsystem_platform.dylib 000000000000000000 _sigtramp + 1293763808 5 libsystem_c.dylib 0x00007fffb2cb0420 abort + 129 6 libsystem_c.dylib 0x00007fffb2c77893 basename_r + 0 7 clang-8 0x00000001033611a8 llvm::ScalarEvolution::computeExitLimit(llvm::Loop const*, llvm::BasicBlock*, bool) + 1320 8 clang-8 0x000000010335e984 llvm::ScalarEvolution::computeBackedgeTakenCount(llvm::Loop const*, bool) + 276 9 clang-8 0x000000010335d6bf llvm::ScalarEvolution::getBackedgeTakenInfo(llvm::Loop const*) + 335 10 clang-8 0x000000010335a49f llvm::ScalarEvolution::getRangeRef(llvm::SCEV const*, llvm::ScalarEvolution::RangeSignHint) + 8335 11 clang-8 0x0000000103349e72 StrengthenNoWrapFlags(llvm::ScalarEvolution*, llvm::SCEVTypes, llvm::SmallVectorImpl const&, llvm::SCEV::NoWrapFlags) + 530 12 clang-8 0x000000010333fbdf llvm::ScalarEvolution::getMulExpr(llvm::SmallVectorImpl&, llvm::SCEV::NoWrapFlags, unsigned int) + 351 13 clang-8 0x000000010334f9c2 llvm::ScalarEvolution::createSCEV(llvm::Value*) + 1954 14 clang-8 0x000000010334bb74 llvm::ScalarEvolution::getSCEV(llvm::Value*) + 84 15 clang-8 0x000000010334fbb1 llvm::ScalarEvolution::createSCEV(llvm::Value*) + 2449 16 clang-8 0x000000010334bb74 llvm::ScalarEvolution::getSCEV(llvm::Value*) + 84 17 clang-8 0x000000010334fab1 llvm::ScalarEvolution::createSCEV(llvm::Value*) + 2193 18 clang-8 0x000000010334bb74 llvm::ScalarEvolution::getSCEV(llvm::Value*) + 84 19 clang-8 0x000000010334fab1 llvm::ScalarEvolution::createSCEV(llvm::Value*) + 2193 20 clang-8 0x000000010334bb74 llvm::ScalarEvolution::getSCEV(llvm::Value*) + 84 21 clang-8 0x0000000103a4f783 bool instrumentMemAccess(llvm::Value*, llvm::Value*, llvm::DataLayout const&, llvm::TargetLibraryInfo&, llvm::ObjectSizeOffsetEvaluator&, llvm::IRBuilder&, addBoundsChecking(llvm::Function&, llvm::TargetLibraryInfo&, llvm::ScalarEvolution&)::$_0, llvm::ScalarEvolution&) + 627 22 clang-8 0x0000000103a4f28e addBoundsChecking(llvm::Function&, llvm::TargetLibraryInfo&, llvm::ScalarEvolution&) + 686 23 clang-8 0x0000000103841720 llvm::FPPassManager::runOnFunction(llvm::Function&) + 960 24 clang-8 0x000000010320d9a2 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) + 1522 25 clang-8 0x0000000103841e11 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 897 26 clang-8 0x00000001040cca84 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr >) + 19188 27 clang-8 0x000000010433ec2a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 970 28 clang-8 0x0000000105094233 clang::ParseAST(clang::Sema&, bool, bool) + 547 29 clang-8 0x00000001045e613c clang::FrontendAction::Execute() + 76 30 clang-8 0x000000010459f2d1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1217 31 clang-8 0x000000010467ac00 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1552 32 clang-8 0x00000001023cf227 cc1_main(llvm::ArrayRef, char const*, void*) + 1527 33 clang-8 0x00000001023cd328 main + 10120 34 libdyld.dylib 0x00007fffb2c1c235 start + 1 35 libdyld.dylib 0x0000000000000075 start + 1295924801 clang-8: error: unable to execute command: Abort trap: 6 clang-8: error: clang frontend command failed due to signal (use -v to see invocation) clang version 8.0.0 (trunk 338721) (llvm/trunk 338718) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Users/builder/llvm/llvm-rel-install/bin clang-8: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang-8: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-8: note: diagnostic msg: /var/folders/1f/5gdf_5y50p38r5vgk0qjthzh0000gn/T/V_GaussIntegration-6366db.cpp clang-8: note: diagnostic msg: /var/folders/1f/5gdf_5y50p38r5vgk0qjthzh0000gn/T/V_GaussIntegration-6366db.sh clang-8: note: diagnostic msg: Crash backtrace is located in clang-8: note: diagnostic msg: /Users/builder/Library/Logs/DiagnosticReports/clang-8__.crash clang-8: note: diagnostic msg: (choose the .crash file that corresponds to your crash) clang-8: note: diagnostic msg: ******************** ``` Files attached.
Created attachment 20636 [details] repro case
Created attachment 20637 [details] repro case
This is caused by commit https://reviews.llvm.org/rL337830. It's using ScalarEvolution for a loop whose structure is being modified by the instrumentation code.
Thanks Krzysztof. I'm not familiar with phabricator, and can't figure what svn revision that change was. Is it r337830 per the URL? 7.0.0-rc1 was just tagged (from the branch at r338847). So I guess this bug should go into the 7.0 blockers?
(In reply to Sean McBride from comment #4) > I'm not familiar with phabricator, and can't figure what svn revision that > change was. Is it r337830 per the URL? Yes. Dnnn is a review #nnn, rLnnn is a commit rnnn. > 7.0.0-rc1 was just tagged (from the branch at r338847). > > So I guess this bug should go into the 7.0 blockers? The fix was committed into the master branch in https://reviews.llvm.org/rL338902. It needs to be committed in release_70.
It was merged to the 7.0 branch in r339239. Thanks!