[PATCH] D22588: [compiler-rt] Fix broken unittest related to 64-bit print format

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 13:30:03 PDT 2016


etienneb created this revision.
etienneb added a reviewer: rnk.
etienneb added subscribers: chrisha, wang0109, llvm-commits.
Herald added a subscriber: kubabrecka.

The printf is not working correctly on 64-bit MSVC.

The portable way to print "size_t" is to use "%zx" (size_t in hexa).

https://reviews.llvm.org/D22588

Files:
  test/asan/TestCases/debug_mapping.cc

Index: test/asan/TestCases/debug_mapping.cc
===================================================================
--- test/asan/TestCases/debug_mapping.cc
+++ test/asan/TestCases/debug_mapping.cc
@@ -15,7 +15,7 @@
   __asan_get_shadow_mapping(&scale, &offset);
 
   fprintf(stderr, "scale: %d\n", (int)scale);
-  fprintf(stderr, "offset: 0x%lx\n", offset);
+  fprintf(stderr, "offset: 0x%zx\n", offset);
 
   // CHECK: scale: [[SCALE]]
   // CHECK: offset: [[OFFSET]]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22588.64747.patch
Type: text/x-patch
Size: 466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160720/ca15529a/attachment-0001.bin>


More information about the llvm-commits mailing list