Skip to content
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

core.builtins: Fix return value of likely/unlikely #20682

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jan 10, 2025

For both GCC and LLVM, __builtin_expect and llvm_expect respectively return an integer, not a boolean. This triggers a compiler error as implicit narrow conversions are not allowed.

@ibuclaw ibuclaw added Compiler:GDC Gnu D Compiler Compiler:LDC LLVM based D Compiler Druntime Specific to druntime labels Jan 10, 2025
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#20682"

Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again: should this target stable?

@dkorpel
Copy link
Contributor

dkorpel commented Jan 10, 2025

These don't exist in stable yet.

For both GCC and LLVM, `__builtin_expect` and `llvm_expect` respectively
return an integer, not a boolean. This triggers a compiler error as
implicit narrow conversions are not allowed.
@ibuclaw ibuclaw force-pushed the fix_builtin_expect branch from 665ee63 to 2597d35 Compare January 10, 2025 23:17
@thewilsonator thewilsonator merged commit 1260642 into dlang:master Jan 10, 2025
31 of 40 checks passed
@ibuclaw ibuclaw deleted the fix_builtin_expect branch January 11, 2025 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compiler:GDC Gnu D Compiler Compiler:LDC LLVM based D Compiler Druntime Specific to druntime Merge:auto-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants