[PATCH] D49161: Fix reading 32 bit gcov tag values on little-endian machines

Marco Castelluccio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 16:34:59 PDT 2018


marco-c created this revision.
marco-c added reviewers: uweigand, davidxl.
Herald added subscribers: Sanitizers, llvm-commits.

The write buffer contains signed chars, which means the shift operations caused values such as the arc tag value (0x01a10000) to be read incorrectly (0xffa10000).

This fixes a regression from https://reviews.llvm.org/D49132.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49161

Files:
  lib/profile/GCDAProfiling.c


Index: lib/profile/GCDAProfiling.c
===================================================================
--- lib/profile/GCDAProfiling.c
+++ lib/profile/GCDAProfiling.c
@@ -79,7 +79,7 @@
  * Buffer that we write things into.
  */
 #define WRITE_BUFFER_SIZE (128 * 1024)
-static char *write_buffer = NULL;
+static unsigned char *write_buffer = NULL;
 static uint64_t cur_buffer_size = 0;
 static uint64_t cur_pos = 0;
 static uint64_t file_size = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49161.154902.patch
Type: text/x-patch
Size: 447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180710/bb6717de/attachment.bin>


More information about the llvm-commits mailing list