================ @@ -2919,6 +2916,39 @@ Check for assignment of a fixed address to a pointer. p = (int *) 0x10000; // warn } +.. _alpha-core-FixedAddressDereference: + +alpha.core.FixedAddressDereference (C, C++, ObjC) +""""""""""""""""""""""""""""""""""""""""""""""""" +Check for dereferences of fixed addresses. + +A pointer contains a fixed address if it was set to a hard-coded value or it +becomes otherwise obvious that at that point it can have only a single specific +value. + +.. code-block:: c + + void test1() { + int *p = (int *)0x020; + int x = p[0]; // warn + } + + void test2(int *p) { + if (p == (int *)-1) + *p = 0; // warn + } + + 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 + } + +The analyzer option ``suppress-all-address-spaces`` affects this checker. If it +is set to true pointer dereferences with any address space are not reported as +error. Otherwise only address spaces 256, 257, 258 on target x86/x86-64 are +excluded from reporting as error. The default is all address spaces. ---------------- NagyDonat wrote:
```suggestion If the analyzer option ``suppress-all-address-spaces`` 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 reports from the specific x86 address spaces 256, 257 and 258 are still suppressed, but fixed address dereferences from other address spaces are reported. ``` This is the same paragraph that I suggested for the `NullDereference` checker. https://github.com/llvm/llvm-project/pull/127191 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits