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

Clang sometimes crashes with LowFat enabled #12

Open
GJDuck opened this issue Jul 27, 2018 · 0 comments
Open

Clang sometimes crashes with LowFat enabled #12

GJDuck opened this issue Jul 27, 2018 · 0 comments

Comments

@GJDuck
Copy link
Owner

GJDuck commented Jul 27, 2018

Reported by Hu Hong:

Clang sometimes crashes with LowFat enabled. For example, the program:

#include <future>
int main () {
    return std::async([]{return 1;}).get();
}

will cause clang/LLVM to crash if LowFat is enabled:

$ clang++ -fsanitize=lowfat -std=c++11 -c crash.cpp
fatal error: error in backend: Cannot select: 0x593c230: i64 = X86ISD::WrapperRIP 
TargetGlobalTLSAddress:i64<i8** @_ZSt15__once_callable> 0 [TF=10]
  0x5875d20: i64 = TargetGlobalTLSAddress<i8** @_ZSt15__once_callable> 0 [TF=10]
In function: ...

The same crash occurs with unmodified clang/LLVM with the large code model enabled:

$ clang++-4.0 -std=c++11 -c crash.cpp -mcmodel=large
fatal error: error in backend: Cannot select: 0x46cdbd8: i64 = X86ISD::WrapperRIP 
TargetGlobalTLSAddress:i64<i8** @_ZSt15__once_callable> 0 [TF=10]
  0x46cd830: i64 = TargetGlobalTLSAddress<i8** @_ZSt15__once_callable> 0 [TF=10]
In function: ...

This suggests that the bug is in clang/LLVM itself and not LowFat (LowFat merely enables the large code model enabled when the -fsanitize=lowfat flag is present). The bug also appears in later versions of LLVM, and has been reported before:

http://lists.llvm.org/pipermail/llvm-bugs/2016-March/045572.html

The following options will work-around the problem, but also mean that globals will not be instrumented:

-mcmodel=small -mllvm -lowfat-no-replace-globals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant