[clang] [Sema] Add check for bitfield assignments to larger integral types (PR #68276)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 11:44:23 PDT 2023


AaronBallman wrote:

> Hi @AaronBallman , I ran a compile using this change on clang as you asked and have results. The compile ran with no crashes or errors, and produced 1478 bitfield-conversion warnings. I'll show a few examples below. To put that number into context, I enabled -Wconversion to compare the new warning - bitfield-conversion - with the other conversion checks. You can see from the results that while 1478 findings is large, it's less than 10% of the total conversion findings that exist - so looking at those numbers in context is helpful.
> 
> Are there any other suggested improvements for this patch, or do you think it's ok to merge?
> 
> ![image](https://user-images.githubusercontent.com/58314289/273438293-44313d33-6763-434b-92cb-37df8173209a.png)

Thank you for running the experiment! From spot-checking the results, did they help you to find any actual bugs? And did you notice any patterns in the results that could be used to safely silence the diagnostic in some cases?

https://github.com/llvm/llvm-project/pull/68276


More information about the cfe-commits mailing list