-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[libc] Fix internal alignment in allcoator #146738
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ TEST_MAIN(int, char **, char **) { | |
// aligned_alloc with valid alignment and size | ||
void *ptr = LIBC_NAMESPACE::aligned_alloc(32, 16); | ||
EXPECT_NE(ptr, nullptr); | ||
EXPECT_EQ(__builtin_is_aligned(ptr, 32), 0U); | ||
EXPECT_TRUE(__builtin_is_aligned(ptr, 32)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it is not aligned to alignment before even we call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aligned_alloc here should return an aligned pointer, it's just checking if that's true. |
||
|
||
LIBC_NAMESPACE::free(ptr); | ||
|
||
|
@@ -23,7 +23,7 @@ TEST_MAIN(int, char **, char **) { | |
void *div = | ||
LIBC_NAMESPACE::aligned_alloc(alignment, (gpu::get_thread_id() + 1) * 4); | ||
EXPECT_NE(div, nullptr); | ||
EXPECT_EQ(__builtin_is_aligned(div, alignment), 0U); | ||
EXPECT_TRUE(__builtin_is_aligned(div, alignment)); | ||
|
||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this becomes
<=
now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround for this exact bug because I knew that the true minimum alignment was
8
and now it's 16 correctly.