Examples of errors detected by the V1063 diagnostic
V1063. The modulo by 1 operation is meaningless. The result will always be zero.
LLVM/Clang
V1063 The modulo by 1 operation is meaningless. The result will always be zero. llvm-stress.cpp 631
void Act() override {
....
// If the value type is a vector, and we allow vector select, then in 50%
// of the cases generate a vector select.
if (isa<FixedVectorType>(Val0->getType()) && (getRandom() % 1)) {
unsigned NumElem =
cast<FixedVectorType>(Val0->getType())->getNumElements();
CondTy = FixedVectorType::get(CondTy, NumElem);
}
....
}
Qt
V1063 The modulo by 1 operation is meaningless. The result will always be zero. qm.cpp 549
bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
{
....
case Tag_Translation: {
int len = read32(m);
if (len % 1) { // <=
cd.appendError(QLatin1String("QM-Format error"));
return false;
}
m += 4;
QString str = QString((const QChar *)m, len/2);
....
}
MuseScore
V1063 The modulo by 1 operation is meaningless. The result will always be zero. lyrics.h 85
class Lyrics final : public TextBase
{
....
bool isEven() const { return _no % 1; }
....
}
GZDoom
V1063 The modulo by 1 operation is meaningless. The result will always be zero. r_draw_rgba.cpp 328
void SWPalDrawers::DrawUnscaledFuzzColumn(const SpriteDrawerArgs& args)
{
....
int fuzzstep = 1;
int fuzz = _fuzzpos % FUZZTABLE;
#ifndef ORIGINAL_FUZZ
while (count > 0)
{
int available = (FUZZTABLE - fuzz);
int next_wrap = available / fuzzstep;
if (available % fuzzstep != 0) // <=
next_wrap++;
....
}
....
}
Xenia
V1063 The modulo by 1 operation is meaningless. The result will always be zero. x64_code_cache_win.cc 299
void Win32X64CodeCache::InitializeUnwindEntry(....)
{
....
if (unwind_info->CountOfCodes % 1)
{
// Count of unwind codes must always be even.
std::memset(&unwind_info->UnwindCode[unwind_info->CountOfCodes + 1], 0,
sizeof(UNWIND_CODE));
....
}
....
}