Skip to content

flow-analysis: increment decrement operators #431

Description

@thradams

I believe the following code is not producing the expected result or diagnostics.

#pragma safety enable

void f(char* p)
{
    while (p)
    {
      if (*p != '\0') {}
      *p = 0;
      p++; //p++ must change the state to unkown
    }
}

Cake 0.13.27
main.c:7:11: warning 28: value is always zero
7 | if (*p != '\0') {}
| ~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions