Skip to content
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
10 changes: 10 additions & 0 deletions cpp/ql/test/library-tests/ir/range-analysis/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,13 @@ void test_div(int x) {
range(x >> 2); // $ range=>=0 range=<=2
}
}

struct X { int n; };
void read_argument(const X *);

void nonterminating_without_operands_as_ssa(X *x) {
read_argument(x);
while (x->n) {
x->n--;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no expected results for the test. It might be nice to either add some and/or explain that we're mostly checking for an analysis non-termination issue here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed the issue here is specifically nontermination. I can add a comment if the function name doesn't make this clear 🙂

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a little odd that we're supposed to read the function name as a comment on the implementation, though we're not exactly strict about such things. I'd prefer a comment. I don't have strong feelings.