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

No mutation for negate operator #842

Open
ligurio opened this issue Mar 22, 2021 · 1 comment
Open

No mutation for negate operator #842

ligurio opened this issue Mar 22, 2021 · 1 comment

Comments

@ligurio
Copy link
Contributor

ligurio commented Mar 22, 2021

Description

Mull supports mutations for negate operator. (see https://mull.readthedocs.io/en/latest/SupportedMutations.html)

$ cat example.c

int main() {
    int a = 2;
    if (!a)
        a = 4;

    return 0;
}

$ clang -fembed-bitcode -g example.c -o example
$ mull-cxx ./example
[info] Extracting bitcode from executable (threads: 1)
[################################] 1/1. Finished in 0ms
[info] Loading bitcode files (threads: 1)
[################################] 1/1. Finished in 10ms
[info] Sanity check run (threads: 1)
[################################] 1/1. Finished in 4ms
[info] Gathering functions under test (threads: 1)
[################################] 1/1. Finished in 0ms
[info] Applying function filter: no debug info (threads: 2)
[################################] 2/2. Finished in 1ms
[info] Applying function filter: file path (threads: 1)
[################################] 1/1. Finished in 10ms
[info] Instruction selection (threads: 1)
[################################] 1/1. Finished in 1ms
[info] Searching mutants across functions (threads: 1)
[################################] 1/1. Finished in 10ms
[info] Applying filter: no debug info (threads: 1)
[################################] 1/1. Finished in 0ms
[info] Applying filter: file path (threads: 1)
[################################] 1/1. Finished in 0ms
[info] Applying filter: junk (threads: 1)
[################################] 1/1. Finished in 11ms
[info] Deduplicate mutants (threads: 1)
[################################] 1/1. Finished in 0ms
[info] No mutants found. Mutation score: infinitely high
[info] Total execution time: 50ms
$

Version

sergeyb@pony:~/sources/mull_testing$ mull-cxx --version
Mull: LLVM-based mutation testing
https://github.com/mull-project/mull
Version: 0.10.0-trunk1
Commit: 296ee8e
Date: 10 Mar 2021
LLVM: 11.0.0

@m42e
Copy link
Contributor

m42e commented Nov 1, 2021

Well this seems like there is no not happening here. Clang just reverses the order of the branches in its bitcode:

if(!a)

becomes

br i1 %4, label %6, label %5, !dbg !18

See https://godbolt.org/z/1rT8Wrqrz

and

if(a)

becomes

br i1 %4, label %5, label %6, !dbg !18

It may be possible to add a "switch branch mutator".

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

2 participants