https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110529

            Bug ID: 110529
           Summary: -Wanalyzer-null-dereference false nagetive with
                    `*arr[0] = 10086`
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dale.mengli.ming at proton dot me
  Target Milestone: ---

Hi,

```c
void foo(int pc) {
    int *arr[2] = {&&x, &&y};
    int var = 0;
    goto *arr[pc];

x:
    arr[0] = (void *)0;
    *arr[0] = 10086;
    return;
y:
    return;
}

int main() { foo(0); }
```

in this case, the analyzer with `-O3` doesn't report an NPD about `*arr[0] =
10086`.

See it live: https://godbolt.org/z/1E9e5oKdE.

Thanks for taking the time to review this case.
  • [Bug analyzer/110529] New: ... dale.mengli.ming at proton dot me via Gcc-bugs

Reply via email to