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

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 17 04:31:13 PST 2021


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 -analyzer-config eagerly-assume=false -analyzer-checker=debug.ExprInspection,alpha.core.StrictAliasing -verify %s
+// NOTE: -relaxed-aliasing flag disables StrictAliasing checker.
+
----------------
steakhal wrote:
> I think `fno-strict-aliasing` should achieve this, by which the driver should transform that flag into the `-relaxed-aliasing` flag consumed by the backend.
Yes, but here in the RUN line you should use a backend flag `-relaxed-aliasing` instead of `-fno-strict-aliasing`. `-fno-strict-aliasing` won't work here. I've tried.
P.S. Note that the checker works relying on the presentence of `-relaxed-aliasing`, so here the absense of `-relaxed-aliasing` is en equivalent of `-fstrict-aliasing`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114718/new/

https://reviews.llvm.org/D114718



More information about the cfe-commits mailing list