ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.19k stars 258 forks source link

DMD asm: Cannot access struct members #950

Open redstar opened 9 years ago

redstar commented 9 years ago

The following code compiles with DMD but not with LDC:

module app.d;

import std.stdio;

struct test {
        uint a = 42;
        uint b = 7;

        uint getA() {
                uint temp;
                asm {
                        mov RBX, this;
                        mov EAX, a[RBX];
                        mov temp, EAX;
                }
                return temp;
        }
}

public static void main() {
        writeln("asm 'this' test");
        test t;
        writeln("test.getA(): ", t.getA());
        assert(t.getA() == t.a, "getA() failed");
}

Reported by this.getName() in ldc forum.

kinke commented 8 years ago

@redstar You fixed this, right?

kinke commented 8 years ago

Nope still doesn't work.