Commit 0ba1cac6 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix issues found by coverity

Thanks to @denji for the report!
parent 038eb9de
......@@ -661,9 +661,10 @@ public:
ASSERT(0, "dont know how to merge these types: %s, %s", lhs->debugName().c_str(), rhs->debugName().c_str());
abort();
}
static bool merge(const TypeMap& ending, TypeMap& next) {
bool changed = false;
for (TypeMap::const_iterator it = ending.begin(); it != ending.end(); it++) {
for (TypeMap::const_iterator it = ending.begin(); it != ending.end(); ++it) {
CompilerType*& prev = next[it->first];
changed = merge(it->second, prev) || changed;
}
......@@ -706,7 +707,7 @@ public:
in_queue.insert(cfg->getStartingBlock());
int num_evaluations = 0;
while (queue.size()) {
while (!queue.empty()) {
ASSERT(queue.size() == in_queue.size(), "%ld %ld", queue.size(), in_queue.size());
num_evaluations++;
CFGBlock* block = queue.top();
......
......@@ -433,8 +433,8 @@ CompilerVariable* UnknownType::getattr(IREmitter& emitter, const OpInfo& info, C
}
static ConcreteCompilerVariable* _call(IREmitter& emitter, const OpInfo& info, llvm::Value* func, void* func_addr,
const std::vector<llvm::Value*> other_args, ArgPassSpec argspec,
const std::vector<CompilerVariable*> args,
const std::vector<llvm::Value*>& other_args, ArgPassSpec argspec,
const std::vector<CompilerVariable*>& args,
const std::vector<const std::string*>* keyword_names,
ConcreteCompilerType* rtn_type) {
bool pass_keyword_names = (keyword_names != nullptr);
......
......@@ -786,7 +786,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
// And go through and add phi nodes:
ConcreteSymbolTable* pred_st = phi_ending_symbol_tables[pred];
for (ConcreteSymbolTable::iterator it = pred_st->begin(); it != pred_st->end(); it++) {
for (ConcreteSymbolTable::iterator it = pred_st->begin(); it != pred_st->end(); ++it) {
// printf("adding phi for %s\n", it->first.c_str());
llvm::PHINode* phi = emitter->getBuilder()->CreatePHI(it->second->getType()->llvmType(),
block->predecessors.size(), it->first.str());
......@@ -868,7 +868,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
// which we won't read until after all new BBs have been added.
std::vector<std::tuple<llvm::PHINode*, llvm::Value*, llvm::BasicBlock*&>> phi_args;
for (PHITable::iterator it = phis->begin(); it != phis->end(); it++) {
for (PHITable::iterator it = phis->begin(); it != phis->end(); ++it) {
llvm::PHINode* llvm_phi = it->second.second;
for (int j = 0; j < b->predecessors.size(); j++) {
CFGBlock* b2 = b->predecessors[j];
......@@ -993,11 +993,11 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
if (ending_symbol_tables[b] == NULL)
continue;
for (SymbolTable::iterator it = ending_symbol_tables[b]->begin(); it != ending_symbol_tables[b]->end(); it++) {
for (SymbolTable::iterator it = ending_symbol_tables[b]->begin(); it != ending_symbol_tables[b]->end(); ++it) {
it->second->decvrefNodrop();
}
for (ConcreteSymbolTable::iterator it = phi_ending_symbol_tables[b]->begin();
it != phi_ending_symbol_tables[b]->end(); it++) {
it != phi_ending_symbol_tables[b]->end(); ++it) {
it->second->decvrefNodrop();
}
delete phi_ending_symbol_tables[b];
......
......@@ -393,7 +393,7 @@ CompiledFunction* compilePartialFuncInternal(OSRExit* exit) {
// new_effort = EffortLevel::MAXIMAL;
CompiledFunction* compiled
= compileFunction(exit->parent_cf->clfunc, exit->parent_cf->spec, new_effort, exit->entry);
assert(compiled = new_cf);
assert(compiled == new_cf);
}
return new_cf;
......
......@@ -2413,7 +2413,7 @@ public:
void copySymbolsFrom(SymbolTable* st) override {
assert(st);
DupCache cache;
for (SymbolTable::iterator it = st->begin(); it != st->end(); it++) {
for (SymbolTable::iterator it = st->begin(); it != st->end(); ++it) {
// printf("Copying in %s: %p, %d\n", it->first.c_str(), it->second, it->second->getVrefs());
symbol_table[it->first] = it->second->dup(cache);
// printf("got: %p, %d\n", symbol_table[it->first], symbol_table[it->first]->getVrefs());
......
......@@ -54,7 +54,7 @@ void parseEhFrame(uint64_t start_addr, uint64_t size, uint64_t* out_data, uint64
u32 = (uint32_t*)start_addr;
int cie_length = *u32;
*u32++;
u32++;
assert(*u32 == 0); // CIE ID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment