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:
///////////////////////////////
#0  0x000000000040e2c6 in Type::aliasthisOf (this=0x402054f0) at mtype.c:1267
#1  0x000000000041b3d1 in TypeFunction::callMatch (this=0x3fd8f9c0, tthis=0x0,
args=0x40205c80, flag=0) at mtype.c:5901
#2  0x000000000046fd77 in ParamDeduce::fp (this=0x7fffffffa260, fd=0x402061b0)
at template.c:2101
#3  0x000000000046fb57 in ParamDeduce::fp (param=0x7fffffffa260, s=0x402061b0)
at template.c:2055
#4  0x0000000000544a79 in overloadApply (fstart=0x402061b0,
param=0x7fffffffa260, fp=0x46fb01 <ParamDeduce::fp(void*, Dsymbol*)>) at
func.c:2798
#5  0x00000000004710a9 in functionResolve (m=0x7fffffffa390, dstart=0x402061b0,
loc=..., sc=0x4020f010, tiargs=0x0, tthis=0x40205f30, 
    fargs=0x40205c80) at template.c:2423
#6  0x00000000005452d9 in resolveFuncCall (loc=..., sc=0x4020f010,
s=0x402061b0, tiargs=0x0, tthis=0x40205f30, fargs=0x40205c80, flags=0)
    at func.c:3168
#7  0x000000000051ffc8 in CallExp::semantic (this=0x402134f0, sc=0x4020f010) at
expression.c:8456
#8  0x000000000051f8e6 in CallExp::semantic (this=0x40205ca0, sc=0x4020f010) at
expression.c:8363
#9  0x000000000045eab1 in ReturnStatement::semantic (this=0x40205cf0,
sc=0x4020f010) at statement.c:3729
#10 0x0000000000451aab in CompoundStatement::semantic (this=0x40205d20,
sc=0x4020f010) at statement.c:1031
#11 0x000000000053f824 in FuncDeclaration::semantic3 (this=0x40205a30,
sc=0x402095f0) at func.c:1534
#12 0x0000000000467111 in AggregateDeclaration::semantic3 (this=0x40205300,
sc=0x40209280) at struct.c:235
#13 0x000000000047f167 in TemplateInstance::semantic3 (this=0x7ffff64833b0,
sc=0x7fffe91b4a10) at template.c:7344
#14 0x000000000047a87e in TemplateInstance::trySemantic3 (this=0x7ffff64833b0,
sc2=0x7fffe91b4a10) at template.c:5641
#15 0x000000000047b894 in TemplateInstance::semantic (this=0x7ffff64833b0,
sc=0x7fffe9190610, fargs=0x0) at template.c:6064
#16 0x000000000047a652 in TemplateInstance::semantic (this=0x7ffff64833b0,
sc=0x7fffe9190610) at template.c:5582
#17 0x000000000041de22 in TypeInstance::resolve (this=0x7ffff6483580, loc=...,
sc=0x7fffe9190610, pe=0x7fffffffbe78, pt=0x7fffffffbe80, 
    ps=0x7fffffffbe70, intypeid=false) at mtype.c:6754
#18 0x000000000041df25 in TypeInstance::semantic (this=0x7ffff6483580, loc=...,
sc=0x7fffe9190610) at mtype.c:6776
#19 0x00000000004f3b5e in VarDeclaration::semantic (this=0x7ffff6483660,
sc=0x3f339ba0) at declaration.c:854
#20 0x0000000000514899 in DeclarationExp::semantic (this=0x7ffff64837a0,
sc=0x3f339ba0) at expression.c:5845
#21 0x0000000000450fa8 in ExpStatement::semantic (this=0x7ffff6483780,
sc=0x3f339ba0) at statement.c:826
#22 0x0000000000451aab in CompoundStatement::semantic (this=0x7ffff64837e0,
sc=0x3f339ba0) at statement.c:1031
#23 0x000000000053f824 in FuncDeclaration::semantic3 (this=0x7ffff6483160,
sc=0x7fffe9008880) at func.c:1534
#24 0x0000000000409679 in Module::semantic3 (this=0x7ffff7ef0910) at
module.c:795
#25 0x0000000000405d63 in tryMain (argc=113, argv=0x92bc70) at mars.c:1461
#26 0x000000000040689c in main (argc=109, argv=0x7fffffffd268) at mars.c:1668

--
Feb 15 2015