Fixed #2932 (segmentation fault of cppcheck ( i / i ))

This commit is contained in:
Simon Martin 2011-07-24 09:06:38 +02:00 committed by Daniel Marjamäki
parent fc0f75fe6a
commit 539c2e5acb
2 changed files with 8 additions and 11 deletions

View File

@ -1094,17 +1094,6 @@ void CheckOther::checkUnsignedDivision()
} }
} }
} }
else if (Token::Match(tok, "|[|=|return|%op% %var% / %var%"))
{
//std::cout << "cicicicic" << std::endl;
char sign1 = varsign[tok->tokAt(1)->varId()];
char sign2 = varsign[tok->tokAt(3)->varId()];
if ((sign1 == 'u' && sign2 == 's') || (sign1 == 's' && sign2 == 'u'))
{
//udivError(tok);
}
}
} }
} }

View File

@ -64,6 +64,7 @@ private:
TEST_CASE(division7); TEST_CASE(division7);
TEST_CASE(division8); TEST_CASE(division8);
TEST_CASE(division9); TEST_CASE(division9);
TEST_CASE(division10);
} }
void division1() void division1()
@ -198,6 +199,13 @@ private:
TODO_ASSERT_EQUALS("unsigned division", TODO_ASSERT_EQUALS("unsigned division",
"", errout.str()); "", errout.str());
} }
void division10()
{
// Ticket: #2932 - don't segfault
check("i / i");
ASSERT_EQUALS("", errout.str());
}
}; };
REGISTER_TEST(TestDivision) REGISTER_TEST(TestDivision)