[Issue 17220] invalid code with -m32 -inline and struct that's size_t.sizeof x the size of an assigned enum value

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Feb 24 09:13:21 PST 2017


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

--- Comment #3 from Martin Nowak <code at dawg.eu> ---
The cmp runs on the `lhs` symbol, while only the `val` symbol get's
initialized.
Not sure, but seems like the copy got elided.

Here is the assembly for when the size of BCValue != size_t.sizeof *
BCTypeEnum.i32

        mov     cl, 8                                   ; 0018 _ B1, 08
        mov     byte ptr [rbp-78H], cl                  ; 001A _ 88. 4D, 88
        lea     rsi, [rbp-78H]                          ; 001D _ 48: 8D. 75, 88
        lea     rdi, [rbp-38H]                          ; 0021 _ 48: 8D. 7D, C8
        mov     cl, 7                                   ; 0025 _ B1, 07
        rep movsq                                       ; 0027 _ F3 48: A5
        cmp     byte ptr [rbp-38H], 8                   ; 002A _ 80. 7D, C8, 08
        jz      ?_003                                   ; 002E _ 74, 0A

Apparently the `mov cl, 8` instruction is a CSE in the bug case, no idea why
the rep movsq get's omitted b/c of that though.

--


More information about the Digitalmars-d-bugs mailing list