[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2022-01-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 398986. ASDenysPetrov added a comment. Improved the checker. Reworked tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114718/new/ https://reviews.llvm.org/D114718 Files: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal Thanks! I appreciate your comprehensive comment! I'll take everything you suggested into account. Comment at: clang/test/Analysis/Checkers/StrictAliasingChecker/strict-aliasing.cpp:2 +// RUN: %clang_cc1 -std=c++20 -analyze

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. I haven't checked the code, but only the tests and expectations for scalar values. I'll dive deeper if we settled on those. A couple of remarks: 1. I would rather use top-level function parameters of the given type instead of declaring an instance of that type and

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 394290. ASDenysPetrov added a comment. Changed handler `check::` functions. Reworked. Covered more cases. Several cases left (marked as FIXME in the test file). For the glance some of them we can't handle because of (possibly) wrong symbolic modeling.

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:113 + QualType getOriginalType(CheckerContext , SVal V, QualType T) const { +assert(V.getAs() && "Location shall be a Loc."); +V =

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 392821. ASDenysPetrov added a comment. Improved dynamic type recognition. Provided `-fstrict-aliasing` compiler flag dependency. Still has issues with some cases (see it at the bottom of the test file). WIP. CHANGES SINCE LAST ACTION

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @xazax.hun Updated the summary for better undersanding differencies between the Standards. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114718/new/ https://reviews.llvm.org/D114718

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-30 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:48-49 + // + // NOTE: User must provide canonical and unqualified QualType's for the + // correct result. + static bool canAccess(QualType From, QualType To,

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-29 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:58 + : From(From), To(To), Ctx(Ctx) {} + bool canAccessImpl() { +return isSame() || isCharOrByte() || isOppositeSign(); I'd love to see some

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-29 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Awesome, I love it! What would it take to enable this by default? Note that we can enable the checker without emitting any warnings; sinking exotic execution paths (on which strict aliasing is known to be violated) is valuable on its own. Other than that, we'll probably

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @rsmith, @aaron.ballman I kindly invite you to join the review process especially in a part of the Standard interpretation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114718/new/ https://reviews.llvm.org/D114718

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: rsmith, martong, NoQ, vsavchenko, steakhal, aaron.ballman, xazax.hun, Szelethus. ASDenysPetrov added a project: clang. Herald added subscribers: manas, jeroen.dobbelaere, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs,