<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/test/Analysis/iterator-range.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[analyzer] Fix assertion on casting SVal to NonLoc inside the IteratorRange checker</title>
<updated>2023-08-28T10:02:48+00:00</updated>
<author>
<name>Balazs Benics</name>
<email>benicsbalazs@gmail.com</email>
</author>
<published>2023-08-28T10:02:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=985e399647d591d6130ba6fe08c5b5f6cb87d9f6'/>
<id>985e399647d591d6130ba6fe08c5b5f6cb87d9f6</id>
<content type='text'>
The checker assumed that it could safely cast an SVal to Nonloc.
This surfaced because, with std::ranges, we can unintentionally match
on other APIs as well, thus increasing the likelihood of violating
checker assumptions about the context it's invoked.
https://godbolt.org/z/13vEb3K76

See the discourse post on CallDescriptions and std::ranges here.
https://discourse.llvm.org/t/calldescriptions-should-not-skip-the-ranges-part-in-std-names-when-matching/73076

Fixes https://github.com/llvm/llvm-project/issues/65009

Differential Revision: https://reviews.llvm.org/D158968
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The checker assumed that it could safely cast an SVal to Nonloc.
This surfaced because, with std::ranges, we can unintentionally match
on other APIs as well, thus increasing the likelihood of violating
checker assumptions about the context it's invoked.
https://godbolt.org/z/13vEb3K76

See the discourse post on CallDescriptions and std::ranges here.
https://discourse.llvm.org/t/calldescriptions-should-not-skip-the-ranges-part-in-std-names-when-matching/73076

Fixes https://github.com/llvm/llvm-project/issues/65009

Differential Revision: https://reviews.llvm.org/D158968
</pre>
</div>
</content>
</entry>
<entry>
<title>[analyzer] Crash fix for alpha.cplusplus.IteratorRange</title>
<updated>2021-03-10T11:42:24+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2021-03-10T11:41:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bcc662484a95c95f7d193e6a791fc5d1c4a2c74f'/>
<id>bcc662484a95c95f7d193e6a791fc5d1c4a2c74f</id>
<content type='text'>
If the non-iterator side of an iterator operation
`+`, `+=`, `-` or `-=` is `UndefinedVal` an assertions happens.
This small fix prevents this.

Patch by Adam Balogh.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D85424
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the non-iterator side of an iterator operation
`+`, `+=`, `-` or `-=` is `UndefinedVal` an assertions happens.
This small fix prevents this.

Patch by Adam Balogh.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D85424
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer] Hotfix for various crashes in iterator checkers</title>
<updated>2020-07-16T18:49:33+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2020-07-07T10:03:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a59d4ae4313c0a961c50d14c0616b49220c5a469'/>
<id>a59d4ae4313c0a961c50d14c0616b49220c5a469</id>
<content type='text'>
The patch that introduces handling iterators implemented as pointers may
cause crash in some projects because pointer difference is mistakenly
handled as pointer decrement. (Similair case for iterators implemented
as class instances are already handled correctly.) This patch fixes this
issue.

The second case that causes crash is comparison of an iterator
implemented as pointer and a null-pointer. This patch contains a fix for
this issue as well.

The third case which causes crash is that the checker mistakenly
considers all integers as nonloc::ConcreteInt when handling an increment
or decrement of an iterator implemented as pointers. This patch adds a
fix for this too.

The last case where crashes were detected is when checking for success
of an std::advance() operation. Since the modeling of iterators
implemented as pointers is still incomplete this may result in an
assertion. This patch replaces the assertion with an early exit and
adds a FIXME there.

Differential Revision: https://reviews.llvm.org/D83295
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The patch that introduces handling iterators implemented as pointers may
cause crash in some projects because pointer difference is mistakenly
handled as pointer decrement. (Similair case for iterators implemented
as class instances are already handled correctly.) This patch fixes this
issue.

The second case that causes crash is comparison of an iterator
implemented as pointer and a null-pointer. This patch contains a fix for
this issue as well.

The third case which causes crash is that the checker mistakenly
considers all integers as nonloc::ConcreteInt when handling an increment
or decrement of an iterator implemented as pointers. This patch adds a
fix for this too.

The last case where crashes were detected is when checking for success
of an std::advance() operation. Since the modeling of iterators
implemented as pointers is still incomplete this may result in an
assertion. This patch replaces the assertion with an early exit and
adds a FIXME there.

Differential Revision: https://reviews.llvm.org/D83295
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer] Handle pointer implemented as iterators in iterator checkers</title>
<updated>2020-07-01T07:04:28+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2020-06-16T18:00:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9e63b190af76c798b06b1e3b75216abfdeb1bce3'/>
<id>9e63b190af76c798b06b1e3b75216abfdeb1bce3</id>
<content type='text'>
Iterators are an abstraction of pointers and in some data structures
iterators may be implemented by pointers. This patch adds support for
iterators implemented as pointers in all the iterator checkers
(including iterator modeling).

Differential Revision: https://reviews.llvm.org/D82185
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Iterators are an abstraction of pointers and in some data structures
iterators may be implemented by pointers. This patch adds support for
iterators implemented as pointers in all the iterator checkers
(including iterator modeling).

Differential Revision: https://reviews.llvm.org/D82185
</pre>
</div>
</content>
</entry>
<entry>
<title>[analyzer] Stability improvement for IteratorModeling</title>
<updated>2020-05-06T11:16:39+00:00</updated>
<author>
<name>Denys Petrov</name>
<email>dpetrov@accesssoftek.com</email>
</author>
<published>2020-05-06T11:16:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ba8cda989cf884d53596099dc38a0e5a2c351074'/>
<id>ba8cda989cf884d53596099dc38a0e5a2c351074</id>
<content type='text'>
Summary:
Some function path may lead to crash.
Fixed using local variable outside the scope  through a pointer.
Fixed minor misspellings.
Added regression test.

This patch covers a bug https://bugs.llvm.org/show_bug.cgi?id=41485

Reviewed By: baloghadamsoftware

Differential Revision: https://reviews.llvm.org/D78289
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
Some function path may lead to crash.
Fixed using local variable outside the scope  through a pointer.
Fixed minor misspellings.
Added regression test.

This patch covers a bug https://bugs.llvm.org/show_bug.cgi?id=41485

Reviewed By: baloghadamsoftware

Differential Revision: https://reviews.llvm.org/D78289
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer] Use note tags to track container begin and and changes</title>
<updated>2020-03-26T06:56:28+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2020-01-30T12:54:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a3f4d17a1a53c4144a5bb7c14620a5d2790f36ea'/>
<id>a3f4d17a1a53c4144a5bb7c14620a5d2790f36ea</id>
<content type='text'>
Container operations such as `push_back()`, `pop_front()`
etc. increment and decrement the abstract begin and end
symbols of containers. This patch introduces note tags
to `ContainerModeling` to track these changes. This helps
the user to better identify the source of errors related
to containers and iterators.

Differential Revision: https://reviews.llvm.org/D73720
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Container operations such as `push_back()`, `pop_front()`
etc. increment and decrement the abstract begin and end
symbols of containers. This patch introduces note tags
to `ContainerModeling` to track these changes. This helps
the user to better identify the source of errors related
to containers and iterators.

Differential Revision: https://reviews.llvm.org/D73720
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer] IteratorRangeChecker verify `std::advance()`, `std::prev()` and `std::next()`</title>
<updated>2020-03-23T16:33:26+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2020-03-18T19:15:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ccc0d351817bedf3a979144238ffb8e2797285d4'/>
<id>ccc0d351817bedf3a979144238ffb8e2797285d4</id>
<content type='text'>
Upon calling one of the functions `std::advance()`, `std::prev()` and
`std::next()` iterators could get out of their valid range which leads
to undefined behavior. If all these funcions are inlined together with
the functions they call internally (e.g. `__advance()` called by
`std::advance()` in some implementations) the error is detected by
`IteratorRangeChecker` but the bug location is inside the STL
implementation. Even worse, if the budget runs out and one of the calls
is not inlined the bug remains undetected. This patch fixes this
behavior: all the bugs are detected at the point of the STL function
invocation.

Differential Revision: https://reviews.llvm.org/D76379
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Upon calling one of the functions `std::advance()`, `std::prev()` and
`std::next()` iterators could get out of their valid range which leads
to undefined behavior. If all these funcions are inlined together with
the functions they call internally (e.g. `__advance()` called by
`std::advance()` in some implementations) the error is detected by
`IteratorRangeChecker` but the bug location is inside the STL
implementation. Even worse, if the budget runs out and one of the calls
is not inlined the bug remains undetected. This patch fixes this
behavior: all the bugs are detected at the point of the STL function
invocation.

Differential Revision: https://reviews.llvm.org/D76379
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer][NFC] Separate white-box tests for iterator modelling from iterator checker tests</title>
<updated>2019-11-14T15:32:19+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2019-11-08T11:52:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=23022b93293676890b2c707616aaa8327f0e3708'/>
<id>23022b93293676890b2c707616aaa8327f0e3708</id>
<content type='text'>
The recently committed debug.IteratorDebugging checker enables
standalone white-box testing of the modelling of containers and
iterators. For the three checkers based on iterator modelling only
simple tests are needed.

Differential Revision: https://reviews.llvm.org/D70123
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The recently committed debug.IteratorDebugging checker enables
standalone white-box testing of the modelling of containers and
iterators. For the three checkers based on iterator modelling only
simple tests are needed.

Differential Revision: https://reviews.llvm.org/D70123
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer] Iterator Checkers - Make range errors and invalidated access fatal</title>
<updated>2019-08-29T09:35:47+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2019-08-29T09:35:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=12f5c7f0c3b00c08c2f2a6cdfeb532ccb5cca6d7'/>
<id>12f5c7f0c3b00c08c2f2a6cdfeb532ccb5cca6d7</id>
<content type='text'>
Range errors (dereferencing or incrementing the past-the-end iterator or
decrementing the iterator of the first element of the range) and access of
invalidated iterators lead to undefined behavior. There is no point to
continue the analysis after such an error on the same execution path, but
terminate it by a sink node (fatal error). This also improves the
performance and helps avoiding double reports (e.g. in case of nested
iterators).

Differential Revision: https://reviews.llvm.org/D62893

llvm-svn: 370314
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Range errors (dereferencing or incrementing the past-the-end iterator or
decrementing the iterator of the first element of the range) and access of
invalidated iterators lead to undefined behavior. There is no point to
continue the analysis after such an error on the same execution path, but
terminate it by a sink node (fatal error). This also improves the
performance and helps avoiding double reports (e.g. in case of nested
iterators).

Differential Revision: https://reviews.llvm.org/D62893

llvm-svn: 370314
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analyzer] Iterator Checkers - Fix for Crash on Iterator Differences</title>
<updated>2019-08-05T06:45:41+00:00</updated>
<author>
<name>Adam Balogh</name>
<email>adam.balogh@ericsson.com</email>
</author>
<published>2019-08-05T06:45:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8557f17d887ab7e70a44f7b674478a16c6eb0119'/>
<id>8557f17d887ab7e70a44f7b674478a16c6eb0119</id>
<content type='text'>
Iterators differences were mistakenly handled as random decrements which
causes an assertion. This patch fixes this.

llvm-svn: 367802
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Iterators differences were mistakenly handled as random decrements which
causes an assertion. This patch fixes this.

llvm-svn: 367802
</pre>
</div>
</content>
</entry>
</feed>
