[PATCH] D93595: [analyzer] Fix extraction of punned and known scalar SVals

2020-12-26 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers added a comment. Thanks for the comments, @NoQ . I'll carefully review and update. BTW, I found an old Bugzilla case that seems to relate to this change directly -> https://bugs.llvm.org/show_bug.cgi?id=2820. Once this change is evolved and accepted, I'll update that Bugzilla issue a

[PATCH] D93595: [analyzer] Fix extraction of punned and known scalar SVals

2020-12-22 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1648 +else + bitPos = ORegionRawOffs.getOffset().getQuantity(); +return bitPos * Ctx.getCharWidth(); NoQ wrote: > This assignment can overflow. Both because the raw

[PATCH] D93595: [analyzer] Fix extraction of punned and known scalar SVals

2020-12-22 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/test/Analysis/concrete-endian.cpp:49 +#elif defined(__BIG_ENDIAN__) + clang_analyzer_eval(pps[3] == 0x8877); // expected-warning{{TRUE}} + clang_analyzer_eval(pps[2] == 0xaa99); // expected-warning{{TRUE}}

[PATCH] D93595: [analyzer] Fix extraction of punned and known scalar SVals

2020-12-22 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. I think you've found a very nice and compact 50% solution to the problem. I didn't think of this while i was looking for a proper fix. Very nice. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1629-1631 +static SVal getSValAsConcreteInt(SValBuil

[PATCH] D93595: [analyzer] Fix extraction of punned and known scalar SVals

2020-12-20 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers added a comment. Based on a suggestion from Balazs, I reduced the scope of the initial change to just scalars. There is one issue I'd like to hear comments on, and that's how to handle the case of extracting a bit field outside of the represented APInt. Currently, I'm returning Unkno