Bug 16327 – direct floating point equal comparison fails on 32-bit emulation

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-07-27T17:05:54Z
Last change time
2024-12-13T18:49:13Z
Assigned to
No Owner
Creator
Seb
Moved to GitHub: dmd#19164 →

Comments

Comment #0 by greensunny12 — 2016-07-27T17:05:54Z
-------- S fun(S)(in S x) { return -1 / x; } unittest { import std.meta : AliasSeq; foreach (S; AliasSeq!(float, double, real)) { import std.stdio; S i = fun!S(3); assert(i == S(-1) / 3); // this lines passes assert(fun!S(3) == S(-1) / 3); // error } } -------- I tested 32-bit with this command on a x86_64 platform. rdmd -main -unittest -m32 Assembler: ---------- .text._D3foo14__unittestL6_1FZv segment assume CS:.text._D3foo14__unittestL6_1FZv _D3foo14__unittestL6_1FZv: push EBP mov EBP,ESP sub ESP,4 push dword ptr FLAT:.rodata[08h] call _D3foo15__T8crazyfunTfZ8crazyfunFNaNbNiNfxfZf@PC32 fstp float ptr -4[EBP] fld float ptr -4[EBP] fld float ptr _D3foo12__ModuleInfoZ@SYM32[0Dh] fucompp ST(1),ST fstsw AX sahf jp L26 je L30 L26: mov EAX,0Eh call _D3foo15__unittest_failFiZv@PC32 L30: push dword ptr _TMP3@SYM32[0Ah] call _D3foo15__T8crazyfunTfZ8crazyfunFNaNbNiNfxfZf@PC32 fld float ptr _TMP3@SYM32[019h] fucompp ST(1),ST fstsw AX sahf jp L4A je L54 L4A: mov EAX,0Fh call _D3foo15__unittest_failFiZv@PC32 L54: leave ret nop nop .text._D3foo14__unittestL6_1FZv ends .text._D3foo15__T8crazyfunTfZ8crazyfunFNaNbNiNfxfZf segment assume CS:.text._D3foo15__T8crazyfunTfZ8crazyfunFNaNbNiNfxfZf _D3foo15__T8crazyfunTfZ8crazyfunFNaNbNiNfxfZf: fld float ptr FLAT:.rodata[0Ah] fdiv float ptr 4[ESP] ret 4 nop nop nop .text._D3foo15__T8crazyfunTfZ8crazyfunFNaNbNiNfxfZf ends
Comment #1 by robert.schadek — 2024-12-13T18:49:13Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19164 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB