[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 12:00:13 PDT 2022


steakhal added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:978
+    assert(!Ty.isNull());
+    if (Ty.isConstQualified() && Ty->isArithmeticType()) {
       // TODO: We could walk the complex types here and see if everything is
----------------
xazax.hun wrote:
> Why do we need this extra condition? I see that this was the original behavior, just wondering if we actually know. I think there are more types than arithmetic that can be stored in the read only memory.
Well, seems reasonable. Do you think I should remove it here or in a separate patch?


================
Comment at: clang/test/Analysis/globals-are-not-always-immutable.c:70
+  invalidate_globals();
+  clang_analyzer_eval(my_mutable_system_global == x); // expected-warning {{UNKNOWN}} It was previously TRUE.
+}
----------------
martong wrote:
> Just remove these when you commit.
Okay!


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

https://reviews.llvm.org/D127306



More information about the cfe-commits mailing list