Skip to content

Commit 33e58c1

Browse files
committed
some warnings fixes
1 parent 4be0ea5 commit 33e58c1

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

llvm_mode/LLVMInsTrim.so.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ struct InsTrim : public ModulePass {
243243
for (unsigned I = 0; I < PrevLocSize - 1; ++I)
244244
PrevLocShuffle.push_back(ConstantInt::get(Int32Ty, I));
245245

246-
for (unsigned I = PrevLocSize; I < PrevLocVecSize; ++I)
246+
for (int I = PrevLocSize; I < PrevLocVecSize; ++I)
247247
PrevLocShuffle.push_back(ConstantInt::get(Int32Ty, PrevLocSize));
248248

249249
Constant *PrevLocShuffleMask = ConstantVector::get(PrevLocShuffle);

llvm_mode/afl-clang-fast.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,17 @@ int main(int argc, char **argv, char **envp) {
811811
if (strncasecmp(ptr, "ngram", strlen("ngram")) == 0) {
812812

813813
ptr += strlen("ngram");
814-
while (*ptr && (*ptr < '0' || *ptr > '9'))
814+
while (*ptr && (*ptr < '0' || *ptr > '9')) {
815815
ptr++;
816-
if (!*ptr)
817-
if ((ptr = getenv("AFL_LLVM_NGRAM_SIZE")) != NULL)
816+
}
817+
if (!*ptr) {
818+
ptr = getenv("AFL_LLVM_NGRAM_SIZE");
819+
if (!ptr || !*ptr) {
818820
FATAL(
819821
"you must set the NGRAM size with (e.g. for value 2) "
820822
"AFL_LLVM_INSTRUMENT=ngram-2");
823+
}
824+
}
821825
ngram_size = atoi(ptr);
822826
if (ngram_size < 2 || ngram_size > NGRAM_SIZE_MAX)
823827
FATAL(

llvm_mode/afl-llvm-common.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ static std::string getSourceName(llvm::Function *F) {
346346

347347
DILocation *cDILoc = dyn_cast<DILocation>(Loc.getAsMDNode());
348348

349+
if (!cDILoc) {
350+
FATAL("DebugLoc is no DILocation");
351+
}
352+
349353
StringRef instFilename = cDILoc->getFilename();
350354

351355
if (instFilename.str().empty()) {

llvm_mode/afl-llvm-lto-instrumentation.so.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
381381
bool HasStr2 = getConstantStringInfo(Str2P, TmpStr);
382382
if (TmpStr.empty())
383383
HasStr2 = false;
384+
(void) HasStr2 /* never read */
384385
else
385386
Str2 = TmpStr.str();
386387

llvm_mode/afl-llvm-pass.so.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ bool AFLCoverage::runOnModule(Module &M) {
284284
for (unsigned I = 0; I < PrevLocSize - 1; ++I)
285285
PrevLocShuffle.push_back(ConstantInt::get(Int32Ty, I));
286286

287-
for (unsigned I = PrevLocSize; I < PrevLocVecSize; ++I)
287+
for (int I = PrevLocSize; I < PrevLocVecSize; ++I)
288288
PrevLocShuffle.push_back(ConstantInt::get(Int32Ty, PrevLocSize));
289289

290290
Constant *PrevLocShuffleMask = ConstantVector::get(PrevLocShuffle);

0 commit comments

Comments
 (0)