Skip to content

[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

Merged
merged 1 commit into from
Mar 21, 2025
Merged

Conversation

kbenzie
Copy link
Contributor

@kbenzie kbenzie commented Mar 21, 2025

@@ -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);
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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).

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@kbenzie kbenzie changed the title [UR] Fix post commit Windows failure [SYCL] Fix post commit Windows failure Mar 21, 2025
@kbenzie kbenzie changed the title [SYCL] Fix post commit Windows failure [SYCL][UR] Fix post commit Windows failure Mar 21, 2025
@sarnex
Copy link
Contributor

sarnex commented Mar 21, 2025

Build passed so merging

@sarnex sarnex merged commit cb38c59 into sycl Mar 21, 2025
21 of 22 checks passed
@kbenzie kbenzie deleted the benie/fix-post-commit branch March 21, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants