Skip to content

Commit

Permalink
Fix false positive in uninit test involving do-while loops (1252)
Browse files Browse the repository at this point in the history
Work of Alex Wells.

Like we do already for "for" loops, when generating extra ops to test for
uninitialized values, "do-while" loops also need to skip testing of their
condition variable (which we know has not been written yet, under most
circumstances).

Signed-off-by: Alex M. Wells <[email protected]>
AlexMWells authored and lgritz committed Sep 24, 2020
1 parent 4288d57 commit ace9c64
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/liboslexec/llvm_instance.cpp
Original file line number Diff line number Diff line change
@@ -657,6 +657,14 @@ BackendLLVM::llvm_generate_debug_uninit (const Opcode &op)
// don't generate uninit test code for it.
continue;
}
if (op.opname() == Strings::op_dowhile && i == 0) {
// The first argument of 'dowhile' is the condition temp, but
// most likely its initializer has not run yet. Unless there is
// no "condition" code block, in that case we should still test
// it for uninit.
if (op.jump(0) != op.jump(1))
continue;
}

// Default: Check all elements of the variable being read
llvm::Value *ncheck = ll.constant (int(t.numelements() * t.aggregate));

0 comments on commit ace9c64

Please sign in to comment.