[Bug 286] New: Returning AA value whose key is a RefCounted type gets wrong value.

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Sun Mar 11 19:36:53 UTC 2018


https://bugzilla.gdcproject.org/show_bug.cgi?id=286

            Bug ID: 286
           Summary: Returning AA value whose key is a RefCounted type gets
                    wrong value.
           Product: GDC
           Version: development
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw at gdcproject.org
          Reporter: ibuclaw at gdcproject.org

---
import std.uni;
import std.stdio;

//accessor with caching
CharMatcher getMatcher(CodepointSet set)
{
    static CharMatcher[CodepointSet] matcherCache;

    auto p = set in matcherCache;
    if (p)
        return *p;
    return (matcherCache[set] = CharMatcher(set));
}

struct CharMatcher
{
    uint[4] filter;

    this(CodepointSet set)
    {
        auto asciiSet = set & unicode.ASCII;
        foreach (iv; asciiSet.byInterval)
        {
            foreach (v; iv.a .. iv.b)
            {
                immutable i = ((v >> 7) ^ v) & 0x7F;
                filter[i >> 5]  |=  1 << (i & 31);
            }
        }
        writeln(this);
    }
}

void main()
{
    auto t = getMatcher(unicode.Nd);
    writeln(t);
    if (t.filter == [0,0,0,0])
        assert(0);
    return;
}
---

Outputs:
CharMatcher([0, 67043328, 0, 0])
CharMatcher([0, 0, 0, 0])
Illegal instruction

Only happens with -frelease.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the D.gnu mailing list