-
Notifications
You must be signed in to change notification settings - Fork 12.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
__builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails (need "-fstrict-flex-array") #55741
Comments
Quoting from bug #55742 :
Right, the behavior makes some historical sense, but for code bases that have converted all the ancient "fake" flex-arrays to proper flex arrays, there needs to be a way to gain FORTIFY-style protections over structs with fixed-size trailing arrays. This is currently impossible. Adding |
@llvm/issue-subscribers-clang-codegen |
+1 for |
Patch proposed at https://reviews.llvm.org/D126864, @kees @gburgessiv I've added you as reviewers. |
@llvm/issue-subscribers-clang-driver |
It's a bigger match than usual, but I have not found any sub-patterns that reduce: (X / DivC) + sext ((X & (SMin | (DivC - 1)) >u SMin) --> X >>s log2(DivC) https://alive2.llvm.org/ce/z/MJzlhl Fixes issue #55741
When bos1 is used on a member who is both an array and at the end of a structure, it fails to correctly resolve. This kind of behavior should only happen for flexible array members:
Both "middle" and "trailing" should see that "c" is 16 bytes. Only "flex" should be "unbounded":
https://godbolt.org/z/s9nb4Y7q4
This is likely due to trailing all trailing arrays as historical flexible arrays, but it breaks FORTIFY_SOURCE in that any struct with a fixed size trailing array will receive no sanity checking. Please introduce something like "-fstrict-flex-array".
The text was updated successfully, but these errors were encountered: