-
Notifications
You must be signed in to change notification settings - Fork 13.3k
The flag -fno-strict-overflow has not effect with clang #134577
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
Comments
@llvm/issue-subscribers-clang-frontend Author: None (yonghong-song)
The 'fno-strict-overflow' intends to not print out signed-integer-overflow.
gcc honors this but clang not. Based on clang documentation https://clang.llvm.org/docs/DiagnosticsReference.html#wstrict-overflow
-fstrict-overflow (and -fno-strict-overflow) does not have impact all.
The following are some examples:
So in summary, for '-fno-strict-overflow' (which is supposed to surpress overflow error), gcc works properly and clang ignores that flag and will emit error regardless. In linux/Makefile, we have
so the kernel expects to silence signed overflow when ubsan is enabled. Are there any discussions about implementing |
@llvm/issue-subscribers-clang-driver Author: None (yonghong-song)
The 'fno-strict-overflow' intends to not print out signed-integer-overflow.
gcc honors this but clang not. Based on clang documentation https://clang.llvm.org/docs/DiagnosticsReference.html#wstrict-overflow
-fstrict-overflow (and -fno-strict-overflow) does not have impact all.
The following are some examples:
So in summary, for '-fno-strict-overflow' (which is supposed to surpress overflow error), gcc works properly and clang ignores that flag and will emit error regardless. In linux/Makefile, we have
so the kernel expects to silence signed overflow when ubsan is enabled. Are there any discussions about implementing |
Clang supports |
Note that it works with But probably the interaction of these flags should still match what GCC does. |
This pull request
Looks like it intentionally ignores -fno-strict-overflow flag? |
@nikic What do you think about the next step? |
Given that this was an intentional change (cc @JustinStitt), I don't know. I'm not sure whether the fact that this diverges from GCC behavior has been considered in the decision. Possibly the behavior should depend on the order of the flags? (Though that does not match GCC either.) Maybe @AaronBallman knows what to do here :) |
The sanitizer behavior overriding -fwrapv/-fno-strict-overflow is an intentional decision. Some Linux kernel developers were pushing forward this and I think it makes sense. |
Originally, my changelist suggested a new sanitizer |
The 'fno-strict-overflow' intends to not print out signed-integer-overflow.
gcc honors this but clang not. Based on clang documentation https://clang.llvm.org/docs/DiagnosticsReference.html#wstrict-overflow
-fstrict-overflow (and -fno-strict-overflow) does not have impact all.
The following are some examples:
So in summary, for '-fno-strict-overflow' (which is supposed to surpress overflow error), gcc works properly and clang ignores that flag and will emit error regardless.
In linux/Makefile, we have
so the kernel expects to silence signed overflow when ubsan is enabled.
But it only works for gcc build kernel, but not for clang build kernel.
Are there any discussions about implementing
-fno-strict-overflow
properly? Or any alternative?The text was updated successfully, but these errors were encountered: