[PATCH] D149046: [BOLT][Wrapper] Fix off-by-one when parsing 'cmp' output

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 11:55:24 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8421c7ad304f: [BOLT][Wrapper] Fix off-by-one when parsing 'cmp' output (authored by jobnoorman).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149046

Files:
  bolt/utils/llvm-bolt-wrapper.py


Index: bolt/utils/llvm-bolt-wrapper.py
===================================================================
--- bolt/utils/llvm-bolt-wrapper.py
+++ bolt/utils/llvm-bolt-wrapper.py
@@ -206,7 +206,8 @@
     Extracts byte number from cmp output:
     file1 file2 differ: byte X, line Y
     '''
-    return int(re.search(r'byte (\d+),', cmp_out).groups()[0])
+    # NOTE: cmp counts bytes starting from 1!
+    return int(re.search(r'byte (\d+),', cmp_out).groups()[0]) - 1
 
 def report_real_time(binary, main_err, cmp_err, cfg):
     '''


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149046.516484.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/f0c5e432/attachment.bin>


More information about the llvm-commits mailing list