From 539c2e5acb02a2d6f53d1e965dc42da2b320c92a Mon Sep 17 00:00:00 2001 From: Simon Martin Date: Sun, 24 Jul 2011 09:06:38 +0200 Subject: [PATCH] Fixed #2932 (segmentation fault of cppcheck ( i / i )) --- lib/checkother.cpp | 11 ----------- test/testdivision.cpp | 8 ++++++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index fc7919c71..4af77ef25 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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); - } - } } } diff --git a/test/testdivision.cpp b/test/testdivision.cpp index aee9c6cde..fe2e5adef 100644 --- a/test/testdivision.cpp +++ b/test/testdivision.cpp @@ -64,6 +64,7 @@ private: TEST_CASE(division7); TEST_CASE(division8); TEST_CASE(division9); + TEST_CASE(division10); } void division1() @@ -198,6 +199,13 @@ private: TODO_ASSERT_EQUALS("unsigned division", "", errout.str()); } + + void division10() + { + // Ticket: #2932 - don't segfault + check("i / i"); + ASSERT_EQUALS("", errout.str()); + } }; REGISTER_TEST(TestDivision)