-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][UR] Fix post commit Windows failure #17574
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
@@ -321,7 +321,7 @@ void *dynLookup([[maybe_unused]] const char *WinName, | |||
"Symbol " + std::string(FunName) + | |||
" could not be found"); | |||
} | |||
return retVal; | |||
return reinterpret_cast<void *>(retVal); |
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.
Isn't it still UB?
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.
Hmm, https://en.cppreference.com/w/cpp/language/reinterpret_cast:
On some implementations (in particular, on any POSIX compatible system as required by dlsym), a function pointer can be converted to void* or any other object pointer, or vice versa. If the implementation supports conversion in both directions, conversion to the original type yields the original value, otherwise the resulting pointer cannot be dereferenced or called safely.
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 would appear so. In which case the return type should be changed, perhaps void (*)(void)
.
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.
In our case it's probably fine, though. We can look into making the version that doesn't reply on language extensions in a future commit.
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 think the error was about an implicit cast, not the fact that we are casting at all. I guess FARPROC
is some kind of function pointer type on clang?
I think on all platforms we support, casting two and from functions and objects works. I could be wrong though.
Build passed so merging |
#17016 (comment)