www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5239] New: optimizer misreports an used before set error

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

           Summary: optimizer misreports an used before set error
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: braddr puremagic.com



---
(an excerpt from runnable/interpret.d)

struct S { int x; }
template Compileable(int z) { bool OK=true;}

int goodfoo3()
{
   S[4] w = void; // uninitialized array of structs
   w[$-2].x = 217; // initialize one member
   return w[2].x; // line 8
}

$ dmd -c -O f.d
f.d(8): Error: variable w used before set

note: filed as d2, but might well exist on d1 as well.. untested

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 18 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5239




---
Part of the test case for bug 6293 triggers this bug when built with -O.  See
runnable/xtet46.d, test6293().  The buggy part is hidden behind version(none).

class C6293 {
    C6293 token;
}
void f6293(in C6293[] a) pure {
    auto x0 = a[0].token;
    assert(x0 is a[0].token.token.token);
    assert(x0 is (&x0).token);
    version(none) {
        auto p1 = &x0 + 1;
        assert(x0 is (p1 - 1).token);
    }
    int c = 0;
    assert(x0 is a[c].token);
}
void test6293() {
    auto x = new C6293;
    x.token = x;
    f6293([x]);
}

See also:
  https://github.com/D-Programming-Language/dmd/pull/243

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 03 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5239


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



17:13:21 PDT ---
https://github.com/D-Programming-Language/dmd/commit/847abf5348b39b6b483cd11280b04d8590f722e5

https://github.com/D-Programming-Language/dmd/commit/12a19326129398af62da52dff86b9cf9f381d7dd

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 03 2011