[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2020-06-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added subscribers: martong, steakhal. @Charusso I think this patch may fix this bug https://bugs.llvm.org/show_bug.cgi?id=25284 Could you please verify and close it if so? At least I couldn't reproduce it on the latest build. Repository: rG LLVM Github Mo

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2020-01-30 Thread Csaba Dabis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGaf3d0d16286a: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store (authored by Charusso). Changed prior to commit: https://reviews.llvm.org/D69599?vs=227546&id=241460#toc Repository: rG L

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment. Thanks for the review! Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:40-48 + if (const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size)) { +CharUnits RegionSize = CharUnits::fromQuantity(SizeInt->getSExtValue()); + +// If a v

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso updated this revision to Diff 227546. Charusso marked 3 inline comments as done. Charusso added a comment. - Done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69599/new/ https://reviews.llvm.org/D69599 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicSiz

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:40-48 + if (const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size)) { +CharUnits RegionSize = CharUnits::fr

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment. Thanks, now it is cool! Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:40-48 + if (const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size)) { +CharUnits RegionSize = CharUnits::fromQuantity(SizeInt->getSExtValue()); + +// If a

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso updated this revision to Diff 227543. Charusso marked 4 inline comments as done. Charusso added a comment. - Old division swapped by `evalBinOp`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69599/new/ https://reviews.llvm.org/D69599 Files: clang/include/clang/StaticAnalyze

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:40-48 + if (const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size)) { +CharUnits RegionSize = CharUnits::fromQuantity(SizeInt->getSExtValue()); + +// If a variable is reinterpreted

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:40-48 + if (const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size)) { +CharUnits RegionSize = CharUnits::fromQuantity(SizeInt->getSExtValue()); + +// If a variable is reinterp

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:40-48 + if (const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size)) { +CharUnits RegionSize = CharUnits::fromQuantity(SizeInt->getSExtValue()); + +// If a variable is reinterpreted

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment. In D69599#1730707 , @NoQ wrote: > > This is the first step to mitigate that issue. > > What's the issue? Well, after I mentioned an issue I have realized the somewhat path-insensitive `getSizeInElements()` does not touch the (v

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso updated this revision to Diff 227524. Charusso marked 2 inline comments as done. Charusso added a comment. - Fix. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69599/new/ https://reviews.llvm.org/D69599 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicSize

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-11-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > This is the first step to mitigate that issue. What's the issue? Comment at: clang/lib/StaticAnalyzer/Core/DynamicSize.cpp:37-39 + const llvm::APSInt *SizeInt = SVB.getKnownValue(State, Size); + if (!SizeInt) +return UnknownVal();

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-10-29 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment. The [1] patch which introduced such static element-count data has only one test case in `outofbound.c`: void f2() { int *p = malloc(12); p[3] = 4; // expected-warning{{Access out-of-bound array element (buffer overflow)}} } which probably wanted to be `(in

[PATCH] D69599: [analyzer] DynamicSize: Remove 'getSizeInElements()' from store

2019-10-29 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso created this revision. Charusso added a reviewer: NoQ. Charusso added a project: clang. Herald added subscribers: cfe-commits, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. This patch uses the new `DynamicSize.cpp` to serve dynamic info