diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index 12c3c8256be..2ab0eb9449c 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -262,9 +262,10 @@ bool IndexedInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) { } error_code IndexedInstrProfReader::readHeader() { - const unsigned char *Start = (unsigned char *)DataBuffer->getBufferStart(); + const unsigned char *Start = + (const unsigned char *)DataBuffer->getBufferStart(); const unsigned char *Cur = Start; - if ((unsigned char *)DataBuffer->getBufferEnd() - Cur < 24) + if ((const unsigned char *)DataBuffer->getBufferEnd() - Cur < 24) return error(instrprof_error::truncated); using namespace support;