aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp2
-rw-r--r--runtime/libprofile/GCDAProfiling.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 23427f77e9..13eecb7f6c 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -140,7 +140,7 @@ namespace {
// A GCOV string is a length, followed by a NUL, then between 0 and 3 NULs
// padding out to the next 4-byte word. The length is measured in 4-byte
// words including padding, not bytes of actual string.
- return (s.size() + 5) / 4;
+ return (s.size() / 4) + 1;
}
void writeGCOVString(StringRef s) {
diff --git a/runtime/libprofile/GCDAProfiling.c b/runtime/libprofile/GCDAProfiling.c
index 8ab4227600..5af94becfe 100644
--- a/runtime/libprofile/GCDAProfiling.c
+++ b/runtime/libprofile/GCDAProfiling.c
@@ -49,7 +49,7 @@ static void write_int64(uint64_t i) {
}
static uint32_t length_of_string(const char *s) {
- return (strlen(s) + 5) / 4;
+ return (strlen(s) / 4) + 1;
}
static void write_string(const char *s) {