www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9912] New: Wrong codegen when using tuple over member variable in more than one method

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9912

           Summary: Wrong codegen when using tuple over member variable in
                    more than one method
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ibuclaw ubuntu.com



GDC bug report:
http://bugzilla.gdcproject.org/show_bug.cgi?id=49

LDC bug report:
https://github.com/ldc-developers/ldc/issues/266

Minimal testcase:
---
template Tuple(Stuff ...) {
    alias Stuff Tuple;
}
struct S {
    int i;
    alias Tuple!i t;
    void a() {
        auto x = t;
    }
    void b() {
        auto x = t;
    }
}
---

Causes an ICE in gdc and ldc because the dotvar expression 'this.i' is cached
and re-used when building the tuple expression in both methods 'a' and 'b'. 
Meaning that both uses of 'this' is given the parent context of method 'a'.

This is a problem when you try to access the 'this' parameter of 'a' from the
function 'b'... Oops, you can't do that!


Problem is in the D frontend, and should be fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 09 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9912


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com



https://github.com/D-Programming-Language/dmd/pull/1881

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 10 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9912




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/85e850bf5697a791e07e7020070d5e705dea1b9d
fix Issue 9912 - Wrong codegen when using tuple over member variable in more
than one method

https://github.com/D-Programming-Language/dmd/commit/73835a8be072a3e9dd18778e6f0c6a31d636563f


Issue 9912 - Wrong codegen when using tuple over member variable in more than
one method

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 16 2013