morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

bool evaluation UB introduced with llvm-9+ #412

Closed smunix closed 3 years ago

smunix commented 3 years ago

See this comment

llvm-9+ machine code instruction selection has introduced a new assembly instruction negating bool values. I have not been able to track when this was introduced in LLVM, but @mo-xiaoming has recently demonstrated that this is definitely a broken behavior introduced by LLVM starting from version 9. He has filed a bug report to llvm-project, here.

Until LLVM devs address the defect, let's patch our compilation in C++ by hand.

Evidence of UB and how the fix works can be found at godbolt