Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path counting incorrect for sequence of statements in switch cases #127

Closed
mringwal opened this issue Apr 10, 2020 · 1 comment
Closed

Comments

@mringwal
Copy link
Contributor

mringwal commented Apr 10, 2020

A sequence of statements in a switch case should be counted similar to a compound statement.

Example:

void path_024_expected_5(int a, int b, int c){
    switch (a){
        case 0:
            if (b){
            }
            if (c){
            }
            break;
        default:
            break;
    }
}

The if(a), if(b) sequence creates 4 paths + 1 for the default = 5, but ccsm reports 3.

If the if-statements are put into a block, we get the expected path count.

void path_025_expected_5(int a, int b, int c){
    switch (a){
        case 0: {
            if (b){
            }
            if (c){
            }
            break;
        }
        default:
            break;
    }
}
@mringwal
Copy link
Contributor Author

Fixed by merged pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant