https://github.com/NagyDonat created 
https://github.com/llvm/llvm-project/pull/182036

None

From d05a84633bf423969939bd4f5bc8f8f24131737c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <[email protected]>
Date: Wed, 18 Feb 2026 15:53:04 +0100
Subject: [PATCH] [NFC][analyzer] Tweak docs of
 optin.core.FixedAddressDereference

---
 clang/docs/analyzer/checkers.rst | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst
index e51015655de65..05a23791a9adb 100644
--- a/clang/docs/analyzer/checkers.rst
+++ b/clang/docs/analyzer/checkers.rst
@@ -874,23 +874,30 @@ numerical value.
  void test3() {
    int (*p_function)(char, char);
    p_function = (int (*)(char, char))0x04080;
-   int x = (*p_function)('x', 'y'); // NO warning yet at functon pointer calls
+   int x = (*p_function)('x', 'y'); // no warning yet at functon pointer calls
  }
 
+Access of fixed numerical addresses can be legitimate in low-level projects
+(e.g. firmware) and hardware interop. These values are often marked as
+``volatile`` to prevent unwanted compiler optimizations)(, so this checker
+doesn't report situations where the pointee of the fixed address is
+``volatile``.
+
+If this suppression is not sufficient on a low-level project, then consider
+disabling this ``optin`` checker.) Note that null pointers will still be
+reported by :ref:`core.NullDereference <core-NullDereference>` regardless if
+the pointee is ``volatile`` or not.
+
+.. code-block:: c
+
  void volatile_pointee() {
-   *(volatile int *)0x404 = 1; // no warning: constant non-null "volatile" 
pointee, you must know what you are doing
+   *(volatile int *)0x404 = 1;// no warning: fixed non-null "volatile" pointee
  }
 
  void deref_volatile_nullptr() {
    *(volatile int *)0 = 1; // core.NullDereference still warns about this
  }
 
-If your project is low-level (e.g., firmware), or deals with hardware interop 
with a lot of genuine constant addresses, then consider disabling this checker.
-The checker automatically suppresses issues if the type of the pointee of the 
address is ``volatile``.
-You probably already need this to be ``volatile`` for legitimate access, so 
the checker suppresses such issues to avoid false-positives.
-Note that null pointers will still be reported by :ref:`core.NullDereference 
<core-NullDereference>`
-regardless if the pointee is ``volatile`` or not.
-
 If the analyzer option ``suppress-dereferences-from-any-address-space`` is set
 to true (the default value), then this checker never reports dereference of
 pointers with a specified address space. If the option is set to false, then

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to