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

            Bug ID: 109197
           Summary: GCC Static Analyzer does not kown `c || b.d` is false
                    with the fact that `c=0` and `b.d=0`
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: geoffreydgr at icloud dot com
  Target Milestone: ---

GSA does not kown `c || b.d` is false with the fact that `c=0` and
`b.d=0`leading to a flase positive, but CSA kowns.

See it live:
GSA: https://godbolt.org/z/vd3Tvdods
CSA: https://godbolt.org/z/PEnv6Ece4

Input:
```c
void __analyzer_eval();


struct a
{
    int d : 10;
}

e(){
    struct a b;
    int c;

    c = 0;
    b.d = 0;
    int *p = (int *)0;
    if (c || b.d)
    {
        __analyzer_eval(c || b.d);
        __analyzer_eval(c);
        __analyzer_eval(b.d);
        *p = 42;
    }
}
```
  • [Bug analyzer/109197] New: GCC ... geoffreydgr at icloud dot com via Gcc-bugs

Reply via email to