Bug 17900 – FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertion failure (test suite)

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
FreeBSD
Creation time
2017-10-15T22:57:17Z
Last change time
2017-12-18T22:54:55Z
Keywords
C++
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2017-10-15T22:57:17Z
Comment #1 by bugzilla — 2017-10-18T03:57:31Z
I tried this with: FreeBSD 11.0-RELEASE-p1 FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) Target: x86_64-unknown-freebsd11.0 Thread model: posix InstalledDir: /usr/bin g++ (FreeBSD Ports Collection) 4.9.4 and it works, both with g++ and c++ (clang). So it's a bit of a mystery at the moment.
Comment #2 by bugzilla — 2017-10-18T06:09:17Z
It does fail with -m32
Comment #3 by bugzilla — 2017-10-18T07:05:06Z
The problem turns out to be the C++ compiler returns: struct S { float a = 1; } in ST0: _Z15passthrough_ptrP1S: mov EAX,4[ESP] fld float ptr [EAX] ret while DMD expects it to be returned in EAX: _Z15passthrough_ptrP1S: mov EAX,4[ESP] fld float ptr [EAX] ret push EBP mov EBP,ESP sub ESP,018h mov -010h[EBP],ESI lea ECX,-4[EBP] mov -0Ch[EBP],EDI mov -4[EBP],EAX mov -018h[EBP],ECX call _Z15passthrough_ptrP1S@PC32 lea ESI,-8[EBP] lea EDI,-4[EBP] mov -8[EBP],EAX <== return value mov ECX,4 xor EAX,EAX rep cmpsb je L41 mov dword ptr -014h[EBP],0Fh mov dword ptr -018h[EBP],offset FLAT:_TMP1[038h]@SYM32 call _d_assertp@PC32 L41: mov ESI,-010h[EBP] mov EDI,-0Ch[EBP] mov ESP,EBP pop EBP ret
Comment #4 by bugzilla — 2017-10-18T09:03:03Z
Comment #5 by github-bugzilla — 2017-10-19T08:25:11Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/85f76f9963ffd81b0a02361dc6dc05a6eb2df5c8 fix Issue 17900 - FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertion failure (test suite) https://github.com/dlang/dmd/commit/88c157c377db8d00f8e55adcd3e8abe3a3ea63cd Merge pull request #7230 from WalterBright/fix17900 fix Issue 17900 - FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertio…
Comment #6 by github-bugzilla — 2017-12-18T22:54:55Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/85f76f9963ffd81b0a02361dc6dc05a6eb2df5c8 fix Issue 17900 - FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertion failure (test suite) https://github.com/dlang/dmd/commit/88c157c377db8d00f8e55adcd3e8abe3a3ea63cd Merge pull request #7230 from WalterBright/fix17900