[PATCH] D80351: llvm-diff: Avoid crash with complex expressions

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 20 18:48:36 PDT 2020


ddcc created this revision.
ddcc added a reviewer: rjmccall.
Herald added a project: LLVM.
ddcc added a comment.

I can trigger the runtime crash when comparing the `_ZN13LaplaceSolver6SolverILi3EE22assemble_linear_systemERNS1_12LinearSystemE` function from the SPEC2006 benchmark 447.dealII, but unfortunately even with `llvm-extract`, I haven't been able to generate a simple testcase for this.


With complex IR, the difference engine can enter an inconsistent state where the instruction and block difference engines return different results. Prevent a crash by refusing to pop beyond the end of the vector.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80351

Files:
  llvm/tools/llvm-diff/DifferenceEngine.cpp


Index: llvm/tools/llvm-diff/DifferenceEngine.cpp
===================================================================
--- llvm/tools/llvm-diff/DifferenceEngine.cpp
+++ llvm/tools/llvm-diff/DifferenceEngine.cpp
@@ -577,7 +577,7 @@
   DiffLogBuilder Diff(Engine.getConsumer());
 
   // Drop trailing matches.
-  while (Path.back() == DC_match)
+  while (Path.size() && Path.back() == DC_match)
     Path.pop_back();
 
   // Skip leading matches.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80351.265403.patch
Type: text/x-patch
Size: 443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200521/b448ace8/attachment-0001.bin>


More information about the llvm-commits mailing list