Changeset 498

Show
Ignore:
Timestamp:
05/23/10 20:51:47 (4 years ago)
Author:
walter
Message:

bugzilla 4210 Random crashes / heisenbugs caused by dmd commit 478: compiler messes up vtables (and some harmonization)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/class.c

    r477 r498  
    662662    { 
    663663        //printf("Creating default this(){} for class %s\n", toChars()); 
    664         ctor = new CtorDeclaration(loc, 0, NULL, 0); 
     664        CtorDeclaration *ctor = new CtorDeclaration(loc, 0, NULL, 0); 
    665665        ctor->fbody = new CompoundStatement(0, new Statements()); 
    666666        members->push(ctor); 
     
    669669        sc->offset = structsize; 
    670670        ctor->semantic(sc); 
     671        this->ctor = ctor; 
    671672        defaultCtor = ctor; 
    672673    } 
  • branches/dmd-1.x/src/declaration.c

    r482 r498  
    11 
    22// Compiler implementation of the D programming language 
    3 // Copyright (c) 1999-2009 by Digital Mars 
     3// Copyright (c) 1999-2010 by Digital Mars 
    44// All Rights Reserved 
    55// written by Walter Bright 
     
    9898        error(loc, "cannot modify parameter '%s' in contract", toChars()); 
    9999 
    100     if (isCtorinit()) 
     100    if (sc->incontract && isResult()) 
     101        error(loc, "cannot modify result '%s' in contract", toChars()); 
     102 
     103    if (isCtorinit() && !t->isMutable()) 
    101104    {   // It's only modifiable if inside the right constructor 
    102105        Dsymbol *s = sc->func; 
     
    477480#if DMDV2 
    478481    type = type->addStorageClass(storage_class); 
    479     if (storage_class & (STCref | STCnothrow | STCpure)) 
     482    if (storage_class & (STCref | STCnothrow | STCpure | STCdisable)) 
    480483    {   // For 'ref' to be attached to function types, and picked 
    481484        // up by Type::resolve(), it has to go into sc. 
    482485        sc = sc->push(); 
    483         sc->stc |= storage_class & (STCref | STCnothrow | STCpure | STCshared); 
     486        sc->stc |= storage_class & (STCref | STCnothrow | STCpure | STCshared | STCdisable); 
    484487        type->resolve(loc, sc, &e, &t, &s); 
    485488        sc = sc->pop(); 
     
    549552        } 
    550553    } 
    551     if (!aliassym) 
    552         aliassym = s; 
     554    //printf("setting aliassym %s to %s %s\n", toChars(), s->kind(), s->toChars()); 
     555    aliassym = s; 
    553556    this->inSemantic = 0; 
    554557} 
     
    671674    offset = 0; 
    672675    noauto = 0; 
     676#if DMDV2 
     677    isargptr = FALSE; 
     678#endif 
    673679#if DMDV1 
    674680    nestedref = 0; 
  • branches/dmd-1.x/src/func.c

    r497 r498  
    150150    foverrides.setDim(0);       // reset in case semantic() is being retried for this function 
    151151 
     152    if (!originalType) 
     153        originalType = type; 
    152154    if (!type->deco) 
    153155    { 
  • branches/dmd-1.x/src/mtype.c

    r496 r498  
    38043804        sc->intypeof++; 
    38053805        exp = exp->semantic(sc); 
     3806#if DMDV2 
     3807        if (exp->type && exp->type->ty == Tfunction && 
     3808            ((TypeFunction *)exp->type)->isproperty) 
     3809            exp = resolveProperties(sc, exp); 
     3810#endif 
    38063811        sc->intypeof--; 
    38073812        if (exp->op == TOKtype) 
  • trunk/src/class.c

    r477 r498  
    350350                if (!tc->sym->symtab || tc->sym->scope || tc->sym->sizeok == 0) 
    351351                { 
    352                     printf("%s: forward reference of base class %s\n", toChars(), tc->sym->toChars()); 
     352                    //printf("%s: forward reference of base class %s\n", toChars(), tc->sym->toChars()); 
    353353                    //error("forward reference of base class %s", baseClass->toChars()); 
    354354                    // Forward reference of base class, try again later 
  • trunk/src/declaration.c

    r490 r498  
    11 
    22// Compiler implementation of the D programming language 
    3 // Copyright (c) 1999-2009 by Digital Mars 
     3// Copyright (c) 1999-2010 by Digital Mars 
    44// All Rights Reserved 
    55// written by Walter Bright 
     
    461461     */ 
    462462    s = type->toDsymbol(sc); 
    463     if (s && ((s->getType() && type->equals(s->getType())) || s->isEnumMember())) 
     463    if (s 
     464#if DMDV2 
     465        && ((s->getType() && type->equals(s->getType())) || s->isEnumMember()) 
     466#endif 
     467        ) 
    464468        goto L2;                        // it's a symbolic alias 
    465469 
  • trunk/src/mtype.c

    r496 r498  
    59255925        sc->intypeof++; 
    59265926        exp = exp->semantic(sc); 
     5927#if DMDV2 
    59275928        if (exp->type && exp->type->ty == Tfunction && 
    59285929            ((TypeFunction *)exp->type)->isproperty) 
    59295930            exp = resolveProperties(sc, exp); 
     5931#endif 
    59305932        sc->intypeof--; 
    59315933        if (exp->op == TOKtype)