Summary: Memory corruption on stack-allocated temporary static
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD

--- Comment #0 from 2012-05-10 12:00:55 PDT ---
        import std.stdio;
        struct S {
                short[4] x;
                this(short[4] args...) {
                        x[] = args[];
                bool opEquals(in S s) const {
                        for (auto i=0; i < 4; i++) {
                                if (this.x[i] != s.x[i])
                                        return false;
                        return true;
        void main() {
                assert(S(1,2,3,4) == S(1,2,3,4));

Output: with dmd -m64, the assertion fails. Inserting writeln's show that the
elements of s in opEquals() are garbage values. Trying to print out the entire
array of this or s causes a segfault.

On dmd -m32, there is no problem.

Not sure if this is related to bug 5570.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to