[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-21 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL349984: [analyzer] pr38668: Do not attempt to cast loaded integers to floats. (authored by dergachev, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit:

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-21 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179389. NoQ added a comment. Herald added a subscriber: jfb. Add a denote - express test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 Files: lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-21 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179379. NoQ added a comment. Add a comment. I guess it doesn't really matter why does this lead to a crash. The symbol itself is well-formed, but we probably don't support it yet in some place, and hopefully (but not necessarily) `CastRetrievedVal` is the only

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-21 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision. george.karpenkov added a comment. Seems good, but a comment explaining why this is necessary and why the crash follows otherwise would be great. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-21 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179355. NoQ added a comment. `// no-crash` and a slightly cleaner test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 Files: lib/StaticAnalyzer/Core/Store.cpp test/Analysis/casts.c

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-21 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179352. NoQ added a comment. Add test case `bool_to_nullptr` in `casts.cpp` on which my second attempt crashes but the current code does not. CHANGES SINCE LAST

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179230. NoQ added a comment. I'll test this more thoroughly. In case it's still wrong, here's a safer fix. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 Files: lib/StaticAnalyzer/Core/Store.cpp

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179228. NoQ added a comment. Add a few more tests, just in case. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 Files: include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 179218. NoQ added a comment. Attempt to define the notion of "type of `SVal`". CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 Files: include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done. NoQ added inline comments. Comment at: lib/StaticAnalyzer/Core/Store.cpp:410 + QualType OrigTy = R->getValueType(); + NoQ wrote: > NoQ wrote: > > This is entirely incorrect. The whole point of this function is to handle

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done. NoQ added inline comments. Comment at: lib/StaticAnalyzer/Core/Store.cpp:410 + QualType OrigTy = R->getValueType(); + NoQ wrote: > This is entirely incorrect. The whole point of this function is to handle the > case when

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ reopened this revision. NoQ added a comment. This revision is now accepted and ready to land. Revert! Comment at: lib/StaticAnalyzer/Core/Store.cpp:410 + QualType OrigTy = R->getValueType(); + This is entirely incorrect. The whole point of this function

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-19 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC349701: [analyzer] pr38668: Do not attempt to cast loaded values of non-scalar types. (authored by dergachev, committed by ). Repository: rC Clang CHANGES SINCE LAST ACTION

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-19 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. Looks good to me. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 ___ cfe-commits

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 178963. NoQ added a comment. Remove the test change that wasn't caused by this patch. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55875/new/ https://reviews.llvm.org/D55875 Files: lib/StaticAnalyzer/Core/Store.cpp test/Analysis/casts.c

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done. NoQ added inline comments. Comment at: test/Analysis/bstring.cpp:47 + // The TRUE warning shows up on the path on which the vector is empty. clang_analyzer_eval(i == 66); // expected-warning {{UNKNOWN}} dcoughlin

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-18 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment. These seems reasonable, although it does also seem like there could be quite a few unintended consequences that we haven't discovered yet. I'm also a bit worried about the change in the analyzer's behavior on copy(). Do you have a sense of how much of an effect this

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision. NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, george.karpenkov, rnkovacs, Szelethus, mikhail.ramalho, baloghadamsoftware. Herald added subscribers: cfe-commits, dkrupp, donat.nagy, a.sidorin, szepet. It is expected to have the same object (memory region)