-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix codegen for sizeof for arrays with non-power-of-2 types #35900
Conversation
In some circumstances Line 189 in 43d8a28
sizeof definition was "correct", so if sizeof is modified, it would be great to have an alternative function playing the role of the current sizeof .
I also don't know if the current definition of
implies that the updated behavior here is the correct one, but it would be great to update the docstring to explain this subtlelty. |
I should have been a bit clearer, this only changes the |
Ah thanks for the clarification! |
(cherry picked from commit a383d61)
This fixes the code generation optimization for the
sizeof()
function to use the array element's alignment if the element is a primitive type instead of the size of the type. This is a fix for #35884. I also found a bug in thesizeof
overload in theSubArrays
type, so this is fixed here as well.I have added in tests for the Array
sizeof()
call, but there are probably more that could be added (so different types are tested) - so any suggestions are appreciated.Fixes #35884.