cc-wrapper: use -fwrapv instead of -fno-strict-overflow in clang#243595
Merged
vcunat merged 1 commit intoNixOS:stagingfrom Jul 26, 2023
tjni:hardening-strict-overflow
Merged
cc-wrapper: use -fwrapv instead of -fno-strict-overflow in clang#243595vcunat merged 1 commit intoNixOS:stagingfrom tjni:hardening-strict-overflow
vcunat merged 1 commit intoNixOS:stagingfrom
tjni:hardening-strict-overflow
Conversation
12 tasks
Contributor
Author
|
This doesn't even work as-is because @isClang@ is not always being substituted properly. I'll leave it as-is pending initial feedback. |
ghost
reviewed
Jul 16, 2023
Contributor
Author
|
I'm marking this as ready for review now because I think it could be committed. On aarch64-darwin, I built |
|
LGTM but I don't use clang much so I'm not really qualified to approve this... it affects quite a lot of builds. |
ghost
reviewed
Jul 18, 2023
12 tasks
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/2466 |
12 tasks
12 tasks
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Please consider this a proof of concept that still needs discussion and testing. I'd appreciate opinions on whether this is the right thing to do. If it is, I'd also like thoughts on how to implement it in a simple, elegant way.Background and Motivation
Reported in #39687, builds on macOS can encounter warnings like :
If we want to suppress this warning (such as in Kitty's build), we can add:
I find these warnings distracting when I debug builds, so I'd like to fix them once and for all (if possible).
Why does Clang emit this warning?
I think it is related to code at https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Clang.cpp#L6449:
That is,
-fno-strict-overflowdoes nothing more than imply-fwrapv. When upstream adds-fwrapv(or even-fno-wrapv) itself, then-fno-strict-overflowdoes nothing, and I suspect it gets reported as unused.What does this PR do?
It simply checks if cc-wrapper is wrapping Clang and uses
-fwrapvinstead of-fno-strict-overflowif so.However, I don't think the way I've done it is so elegant.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)