[Issue 24181] dmd compiled tinylisp.c runtime error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 19 03:30:22 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24181

--- Comment #8 from Walter Bright <bugzilla at digitalmars.com> ---
For this:

    unsigned equ(double x, double y) {
        return *(long long *)&x == *(long long *)&y;
    }

The generated code is:

    equ:
                sub     RSP,018h
                movq    [RSP],XMM0
                mov     RAX,[RSP]
                cmp     RAX,RCX     <== ARRRGHHH!!
                setz    AL
                movzx   RAX,AL
                add     RSP,018h
                ret

The `y` parameter is passed in XMM1, not RCX. The cast to long long has fooled
the code generator.

I suspected something like this was happening, but it took a while to find it.

--


More information about the Digitalmars-d-bugs mailing list