[PATCH] D87892: [flang] Do not dereference an array out of bound just to take its address

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 03:08:50 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2a7744111744: Do not dereference an array out of bound just to take its address (authored by serge-sans-paille).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87892

Files:
  flang/lib/Parser/token-sequence.cpp


Index: flang/lib/Parser/token-sequence.cpp
===================================================================
--- flang/lib/Parser/token-sequence.cpp
+++ flang/lib/Parser/token-sequence.cpp
@@ -160,7 +160,8 @@
   std::size_t atToken{0};
   for (std::size_t j{0}; j < chars;) {
     std::size_t nextStart{atToken + 1 < tokens ? start_[++atToken] : chars};
-    char *p{&char_[j]}, *limit{&char_[nextStart]};
+    char *p{&char_[j]};
+    char const *limit{char_.data() + nextStart};
     j = nextStart;
     if (IsDecimalDigit(*p)) {
       while (p < limit && IsDecimalDigit(*p)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87892.293116.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200921/d1e19693/attachment.bin>


More information about the llvm-commits mailing list