www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14185] New: compiler segfault in aliasthisOf

https://issues.dlang.org/show_bug.cgi?id=14185

          Issue ID: 14185
           Summary: compiler segfault in aliasthisOf
           Product: D
           Version: D1 & D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: vlevenfeld gmail.com

using DMD git-HEAD

///////////////////////////////
CODE:
///////////////////////////////

import core.atomic;
import core.thread;

struct Mutexed (T)
{
    private {
        T store;
        shared bool locked;
    }

    auto acquire ()
    {
        return Lock (this);
    }
    alias acquire this;

    struct Lock
    {
        this (ref Mutexed source)
        {
            this.source = &source;

            while (cas (&source.locked, false, true))
            {}
        }
        ~this ()
        {
            atomicStore (source.locked, false);
        }

        ref get ()
        {
            return source.store;
        }
        alias get this;

        private Mutexed* source;
    }
}
void main ()
{
    Mutexed!(int[]) x;
}

///////////////////////////////
BACKTRACE:
///////////////////////////////


args=0x40205c80, flag=0) at mtype.c:5901

at template.c:2101

at template.c:2055

param=0x7fffffffa260, fp=0x46fb01 <ParamDeduce::fp(void*, Dsymbol*)>) at
func.c:2798

loc=..., sc=0x4020f010, tiargs=0x0, tthis=0x40205f30, 
    fargs=0x40205c80) at template.c:2423

s=0x402061b0, tiargs=0x0, tthis=0x40205f30, fargs=0x40205c80, flags=0)
    at func.c:3168

expression.c:8456

expression.c:8363

sc=0x4020f010) at statement.c:3729

sc=0x4020f010) at statement.c:1031

sc=0x402095f0) at func.c:1534

sc=0x40209280) at struct.c:235

sc=0x7fffe91b4a10) at template.c:7344

sc2=0x7fffe91b4a10) at template.c:5641

sc=0x7fffe9190610, fargs=0x0) at template.c:6064

sc=0x7fffe9190610) at template.c:5582

sc=0x7fffe9190610, pe=0x7fffffffbe78, pt=0x7fffffffbe80, 
    ps=0x7fffffffbe70, intypeid=false) at mtype.c:6754

sc=0x7fffe9190610) at mtype.c:6776

sc=0x3f339ba0) at declaration.c:854

sc=0x3f339ba0) at expression.c:5845

sc=0x3f339ba0) at statement.c:826

sc=0x3f339ba0) at statement.c:1031

sc=0x7fffe9008880) at func.c:1534

module.c:795



--
Feb 15 2015