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

[error] Uh oh! Mull corrupted LLVM module (Tarantool, tzcode) #994

Closed
ligurio opened this issue Apr 27, 2022 · 7 comments · Fixed by #998
Closed

[error] Uh oh! Mull corrupted LLVM module (Tarantool, tzcode) #994

ligurio opened this issue Apr 27, 2022 · 7 comments · Fixed by #998

Comments

@ligurio
Copy link
Contributor

ligurio commented Apr 27, 2022

How to reproduce:

$ git clone https://github/tarantool/tarantool
$ cd tarantool/src/lib/tzcode
$ mkdir build
$ cmake -DCMAKE_C_FLAGS="-fembed-bitcode -g -O0  -fexperimental-new-pass-manager -fpass-plugin=/usr/lib/mull-ir-frontend-12 -grecord-command-line" -DCMAKE_CXX_FLAGS="-fembed-bitcode -g -O0  -fexperimental-new-pass-manager -fpass-plugin=/usr/lib/mull-ir-frontend-12 -grecord-command-line" -DCMAKE_BUILD_TYPE=Debug  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON  -DCMAKE_C_COMPILER="/usr/bin/clang-12" -DCMAKE_CXX_COMPILER="/usr/bin/clang++-12" ..

$ make
...
       [################################] 1/1. Finished in 0ms
[info] Applying mutations (threads: 1)
       [################################] 32/32. Finished in 11ms
[error] Uh oh! Mull corrupted LLVM module.
Please, report the following error message here https://github.com/mull-project/mull/issues
Underlying error message:
PHINode should have one entry for each predecessor of its parent basic block!
  %422 = phi i1 [ false, %410 ], [ false, %407 ], [ %420, %415 ], !dbg !3013 

[error] Error messages are treated as fatal errors. Exiting now.
make[2]: *** [CMakeFiles/tzcode.dir/build.make:95: CMakeFiles/tzcode.dir/strptime.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/tzcode.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

mull.yml:

sergeyb@pony:~/sources/MRG/tarantool/build$ cat ../mull.yml 
mutators:
 - cxx_logical
includePaths:
 - src
excludePaths:
 - third_party
 - test
 - src/lib/small
quiet: false

Source: https://github.com/tarantool/tarantool/blob/master/src/lib/tzcode/strptime.c

$ mull-runner-12 --version
Mull: Practical mutation testing for C and C++
Home: https://github.com/mull-project/mull
Docs: https://mull.readthedocs.io
Version: 0.17.1
Commit: ac98382
Date: 17 Mar 2022
LLVM: 12.0.0

@AlexDenisov
Copy link
Member

There is an issue with cxx_logical_and_to_or.

I'll keep investigating it, but as a temporary workaround I can suggest not using this specific mutator: you can replace cxx_logical with cxx_logical_or_to_and and cxx_remove_negation.

@ligurio
Copy link
Contributor Author

ligurio commented Apr 28, 2022

@AlexDenisov I'll try, thanks!

@AlexDenisov
Copy link
Member

AlexDenisov commented Apr 28, 2022

Smallest reproducer I could get:

void a() {
  int c;
  c = c && c && c;
}

with the following mull.yml

mutators:
  - cxx_logical_and_to_or

and this command:

> clang -g -O0  -fexperimental-new-pass-manager -fpass-plugin=/usr/local/lib/mull-ir-frontend-12 -grecord-command-line -c test.c
[error] Uh oh! Mull corrupted LLVM module.
Please, report the following error message here https://github.com/mull-project/mull/issues
Underlying error message:
PHINode should have one entry for each predecessor of its parent basic block!
  %11 = phi i1 [ false, %4 ], [ false, %0 ], [ %9, %7 ], !dbg !18

[error] Error messages are treated as fatal errors. Exiting now.

@stanislaw do you have any ideas? Seems like a 'trivial' case (or a family of cases) is not handled 😃

@AlexDenisov
Copy link
Member

Actually, the same happens with cxx_logical_or_to_and and

void a() {
  int c;
  c = c || c || c;
}

@AlexDenisov
Copy link
Member

This specific issue is fixed here #998.
I'll add a few more features to debug/workaround such issues in the future and then will cut a new release.

@AlexDenisov
Copy link
Member

Btw, @ligurio you can ignore certain mutators via the following config:

ignoreMutators:
 - cxx_logical_or_to_and
 - cxx_logical_and_to_or

@ligurio
Copy link
Contributor Author

ligurio commented May 5, 2022

Sure, similar issues happen in other files too and I workaround them in config:

mutators:
 - cxx_logical
includePaths:
 - src
excludePaths:
 - third_party      # https://github.com/mull-project/mull/issues/996
 - test
 - src/lib/small
 - src/lib/tzcode   # https://github.com/mull-project/mull/issues/994
 - src/lib/core
 - src/lib/json     # json.c
 - src/box          # xlog.c
quiet: false

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

Successfully merging a pull request may close this issue.

2 participants