-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Coverity's static analysis does not like this pattern in the CUDA generated code. From yaksuri_cudai_kernel_pack_SUM_hvector_hindexed_int16_t.
[...]
uintptr_t x3;
for (intptr_t i = 0; i < md->u.hvector.child->u.hindexed.count; i++) {
uintptr_t in_elems = md->u.hvector.child->u.hindexed.array_of_blocklengths[i] *
md->u.hvector.child->u.hindexed.child->num_elements;
if (res < in_elems) {
x3 = i;
res %= in_elems;
inner_elements = md->u.hvector.child->u.hindexed.child->num_elements;
break;
} else {
res -= in_elems;
}
}
[...]
If the loop exist without the if (res < in_elems) branch ever being taken, then x3 will be uninitialized when it is used later on in the function.
- What is
uintptr_t resrepresenting in this context? It could benefit from a better name. - How can we modify the loop to guarantee static analysis sees
x3as having a valid value?
Metadata
Metadata
Assignees
Labels
No labels