Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test for #11175 - FN: zerodiv #6550

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class TestOther : public TestFixture {
TEST_CASE(zeroDiv17); // #9931
TEST_CASE(zeroDiv18);
TEST_CASE(zeroDiv19);
TEST_CASE(zeroDiv20); // #11175

TEST_CASE(zeroDivCond); // division by zero / useless condition

Expand Down Expand Up @@ -661,6 +662,16 @@ class TestOther : public TestFixture {
ASSERT_EQUALS("[test.cpp:3]: (error) Division by zero.\n", errout_str());
}

void zeroDiv20()
{
check("uint16_t f(void)\n" // #11175
"{\n"
" uint16_t x = 0xFFFFU;\n" // UINT16_MAX=0xFFFF
" return 42/(++x);\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (error) Division by zero.\n", errout_str());
}

void zeroDivCond() {
check("void f(unsigned int x) {\n"
" int y = 17 / x;\n"
Expand Down
Loading