[compiler-rt] r336775 - Fix reading 32 bit gcov tag values on little-endian machines

Marco Castelluccio via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 02:30:25 PDT 2018


Author: marco
Date: Wed Jul 11 02:30:25 2018
New Revision: 336775

URL: http://llvm.org/viewvc/llvm-project?rev=336775&view=rev
Log:
Fix reading 32 bit gcov tag values on little-endian machines

Summary:
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.

Reviewers: uweigand, davidxl

Reviewed By: uweigand

Subscribers: llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D49161

Modified:
    compiler-rt/trunk/lib/profile/GCDAProfiling.c

Modified: compiler-rt/trunk/lib/profile/GCDAProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/GCDAProfiling.c?rev=336775&r1=336774&r2=336775&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/GCDAProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/GCDAProfiling.c Wed Jul 11 02:30:25 2018
@@ -79,7 +79,7 @@ static FILE *output_file = NULL;
  * 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;




More information about the llvm-commits mailing list