Don <> changed:

           What    |Removed                     |Added
            Version|D1                          |D1 & D2
            Summary|Corrupted argument inside   |Corrupted argument inside
                   |out contract for protected  |out contract in x86_64
                   |methods when compiling with |
                   |-O in x86_64                |

--- Comment #2 from Don <> 2012-04-18 01:44:46 PDT ---
Also applies to D2, and does not require -O. Interestingly on D2, adding
'assert(this)' or making it public does not make the bug go away.

This test case applies to D1 if you remove __gshared and add 'protected'.

__gshared size_t second;
class C
    /*protected*/ void f(size_t n)
        second = n;

void main()
    C x = new C;
    assert(second == 6);
This is a parameter passing bug. The code generated for the 'out' contract
assumes that the register parameters were spilled to the stack, but that isn't
necessarily true. Space is allocated on the stack for them, but they aren't
necessarily copied there. On D1, calling the class invariant causes the
parameter (in this case RSI) to be copied to the stack.
Otherwise, 'n' is uninitialized garbage while in the out contract.
The solution is to force all parameters to be copied to the stack when an out
contract is present.

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

Reply via email to