-
Notifications
You must be signed in to change notification settings - Fork 779
[NFCI][SYCL] Eliminate UB in ANSI alias violation accessing ByteArray's #7023
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
Conversation
As part of it provide a nicer (IMO) interface to it. Also, asserts are now moved into the underlying utility functions making it easier to read the core logic up the call stack.
// The map is not locked here because updateSpecConstSymMap() is | ||
// only supposed to be called from c'tor. | ||
MSpecConstSymMap[std::string{SCName}].push_back( | ||
SpecConstDescT{/*ID*/ It[0], /*CompositeOffset*/ It[1], | ||
/*Size*/ It[2], BlobOffset}); | ||
SpecConstDescT{Id, CompositeOffset, Size, BlobOffset}); |
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.
Could be
MSpecConstSymMap[std::string{SCName}].emplace_back(Id, CompositeOffset, Size, BlobOffset);
but should be done in a different PR (if at all).
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 agree, this looks great! Just one minor comment, but I don't think it needs to block this.
T Val; | ||
std::memcpy(&Val, Ptr, sizeof(T)); | ||
Ptr += sizeof(T); | ||
Size -= sizeof(T); |
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.
Nit, but you could call dropBytes(sizeof(T))
here instead. Should make maintainability a little easier, in case something else comes along that needs to be mutated with every move.
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.
It evaluates the assert one more time now, but that should be fine.
@intel/llvm-gatekeepers , this PR is ready. |
As part of it provide a nicer (IMO) interface to it. Also, asserts are now moved into the underlying utility functions making it easier to read the core logic up the call stack.