Bug 22735 – __builtins.di does not implement __builtin_bswap64 correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-04T01:23:48Z
Last change time
2022-07-09T22:13:25Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2022-02-04T01:23:48Z
Reported by https://github.com/ssvb on https://github.com/dlang/druntime/pull/3720#issuecomment-1029329002 foobarmod.c long long foobar() { return __builtin_bswap64(123); } testc.c #include <stdio.h> long long foobar(); int main() { printf("%llx\n", foobar()); return 0; } testd.d import std.stdio, foobarmod; void main() { writefln("%x", foobar()); } Compile and run (on a 64-bit linux system): $ ./dmd testd.d foobarmod.c && ./testd 7b000000 $ gcc testc.c foobarmod.c && ./a.out 7b00000000000000 The results differ and this isn't good.
Comment #1 by dlang-bot — 2022-02-04T01:38:20Z
@WalterBright created dlang/druntime pull request #3721 "fix Issue 22735 - __builtins.di does not implement __builtin_bswap64 …" fixing this issue: - fix Issue 22735 - __builtins.di does not implement __builtin_bswap64 correctly https://github.com/dlang/druntime/pull/3721
Comment #2 by dlang-bot — 2022-02-04T02:17:11Z
dlang/druntime pull request #3721 "fix Issue 22735 - __builtins.di does not implement __builtin_bswap64 …" was merged into master: - 0bcc7bb6d8b67b0c4a8c87089d6e421930ecc76c by Walter Bright: fix Issue 22735 - __builtins.di does not implement __builtin_bswap64 correctly https://github.com/dlang/druntime/pull/3721
Comment #3 by dlang-bot — 2022-07-09T22:13:25Z
dlang/dmd pull request #14281 "[project] Merge druntime into the dmd repository" was merged into master: - 02e8df4436109264143ee56bbe77dc3a58ab33ba by Walter Bright: fix Issue 22735 - __builtins.di does not implement __builtin_bswap64 correctly https://github.com/dlang/dmd/pull/14281