[PATCH] D120843: [flang] Extend ProvenanceRange::Suffix() to handle crash case

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 15:24:53 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG93f42491a54c: [flang] Extend ProvenanceRange::Suffix() to handle crash case (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120843/new/

https://reviews.llvm.org/D120843

Files:
  flang/include/flang/Common/interval.h


Index: flang/include/flang/Common/interval.h
===================================================================
--- flang/include/flang/Common/interval.h
+++ flang/include/flang/Common/interval.h
@@ -103,7 +103,7 @@
     return {start_, std::min(size_, n)};
   }
   Interval Suffix(std::size_t n) const {
-    CHECK(n <= size_);
+    n = std::min(n, size_);
     return {start_ + n, size_ - n};
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120843.412560.patch
Type: text/x-patch
Size: 403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220302/cb37758a/attachment.bin>


More information about the llvm-commits mailing list