-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
scanf format attribute type confusion with char/bool #64987
Comments
Many thanks to @apple-fcloutier for spotting this issue during the review of https://reviews.llvm.org/D158318#4615285. |
Also, I thought about it yesterday evening and I've convinced myself that it really shouldn't be allowed. This can easily store a value other than 0 or 1 in the |
I agree, I think we should diagnose this by default. |
… scanf Fixes llvm#64987 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D159279
… scanf Fixes llvm/llvm-project#64987 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D159279
The scanf format attribute currently issues no diagnostics when confusing a
bool
value and achar
specifier, though GCC does diagnose. Consider:https://godbolt.org/z/jrcKzPb9r
Clang emits no diagnostic in this case, while GCC emits
format '%hhi' expects argument of type 'signed char *', but argument 2 has type '_Bool *'
Perhaps Clang should diagnose similar to GCC?
The text was updated successfully, but these errors were encountered: