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

            Bug ID: 108492
           Summary: __analyzer_eval has effect on the analysis result of
                    gcc static analyzer
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: mengli.ming at outlook dot com
  Target Milestone: ---

case:

```c
void __analyzer_eval();

void f(int b)
{
    int c = 1;
    __analyzer_eval(c && (c = 0) | b);
    if (c && (c = 0) | b)
    {
        int *p = (int *)0;
        __analyzer_eval(c && (c = 0) | b);
        if (c && (c = 0) | b)
        {
            *p = 42;
        }
    }
}

```

In this case, when `__analyzer_eval` is added at line 6
(https://godbolt.org/z/defnzqKPn), the eval statement inside the if branch has
no output. However, when line 6 is commented out
(https://godbolt.org/z/j4dGGEM1s), then the result is output. 

Also, the eval result of `(c && (c = 0) | b)` should probably be TRUE after
analyzer goes inside the if branch.

Thank you for taking the time to review this case.
  • [Bug analyzer/108492] New: __a... mengli.ming at outlook dot com via Gcc-bugs

Reply via email to