Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 588

Show
Ignore:
Timestamp:
07/26/10 05:39:20 (14 years ago)
Author:
walter
Message:

bugzilla 4506 Regression(2.034): -O flag breaks some recursive functions.

Files:

Legend:

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

    r493 r588  
    11// Copyright (C) 1986-1998 by Symantec 
    2 // Copyright (C) 2000-2009 by Digital Mars 
     2// Copyright (C) 2000-2010 by Digital Mars 
    33// All Rights Reserved 
    44// http://www.digitalmars.com 
    55// Written by Walter Bright 
    66/* 
    77 * This source file is made available for personal use 
    88 * only. The license is in /dmd/src/dmd/backendlicense.txt 
    99 * or /dm/src/dmd/backendlicense.txt 
    1010 * For any other uses, please contact Digital Mars. 
    1111 */ 
    1212 
    1313#if (SCPP || MARS) && !HTOD 
    1414 
    1515#include        <stdio.h> 
    1616#include        <time.h> 
    1717 
    1818#include        "cc.h" 
    1919#include        "global.h" 
    2020#include        "el.h" 
    2121#include        "go.h" 
    2222#include        "oper.h" 
     
    463463 
    464464    //printf("checkprop: "); WReqn(n); printf("\n"); 
    465465    assert(n && n->Eoper == OPvar); 
    466466    elem_debug(n); 
    467467    sv = n->EV.sp.Vsym; 
    468468    assert(sytab[sv->Sclass] & SCRD); 
    469469    nty = n->Ety; 
    470470    if (!tyscalar(nty)) 
    471471        goto noprop; 
    472472    nsize = size(nty); 
    473473    noff = n->EV.sp.Voffset; 
    474474    unambig = sv->Sflags & SFLunambig; 
    475475    for (l = rdlist; l; l = list_next(l)) 
    476476    {   elem *d = (elem *) list_ptr(l); 
    477477 
    478478        elem_debug(d); 
    479479 
    480480        //printf("\trd: "); WReqn(d); printf("\n"); 
    481481        if (d->Eoper == OPasm)          /* OPasm elems ruin everything  */ 
    482482            goto noprop; 
     483#if 0 
     484        // Runs afoul of Buzilla 4506 
    483485        if (OTassign(d->Eoper) && EBIN(d))      // if assignment elem 
     486#else 
     487        if (OTassign(d->Eoper))      // if assignment elem 
     488#endif 
    484489        {   elem *t = Elvalue(d); 
    485490 
    486491            if (t->Eoper == OPvar) 
    487492            {   assert(t->EV.sp.Vsym == sv); 
    488493 
    489494                if (d->Eoper == OPstreq || 
    490495                    !tyscalar(t->Ety)) 
    491496                    goto noprop;        // not worth bothering with these cases 
    492497 
    493498                /* Everything must match or we must skip this variable  */ 
    494499                /* (in case of assigning to overlapping unions, etc.)   */ 
    495500                if (t->EV.sp.Voffset != noff || 
    496501                    /* If sizes match, we are ok        */ 
    497502                    size(t->Ety) != nsize && 
    498503                        !(d->E2->Eoper == OPconst && size(t->Ety) > nsize && !tyfloating(d->E2->Ety))) 
    499504                    goto noprop; 
    500505            } 
    501506            else 
    502507            {   if (unambig)            /* unambiguous assignments only */ 
    503508                    continue; 
  • branches/dmd-1.x/src/parse.c

    r585 r588  
    54435443    else if (token.value == TOKlparen) 
    54445444        arguments = parseArguments(); 
    54455445#endif 
    54465446    e = new NewExp(loc, thisexp, newargs, t, arguments); 
    54475447    return e; 
    54485448} 
    54495449 
    54505450/********************************************** 
    54515451 */ 
    54525452 
    54535453void Parser::addComment(Dsymbol *s, unsigned char *blockComment) 
    54545454{ 
    54555455    s->addComment(combineComments(blockComment, token.lineComment)); 
    54565456    token.lineComment = NULL; 
    54575457} 
    54585458 
    54595459/********************************** 
    54605460 * Set operator precedence for each operator. 
    54615461 */ 
    54625462 
     5463enum PREC precedence[TOKMAX]; 
     5464 
    54635465void initPrecedence() 
    54645466{ 
    54655467    precedence[TOKdotvar] = PREC_primary; 
    54665468    precedence[TOKimport] = PREC_primary; 
    54675469    precedence[TOKidentifier] = PREC_primary; 
    54685470    precedence[TOKthis] = PREC_primary; 
    54695471    precedence[TOKsuper] = PREC_primary; 
    54705472    precedence[TOKint64] = PREC_primary; 
    54715473    precedence[TOKfloat64] = PREC_primary; 
    54725474    precedence[TOKnull] = PREC_primary; 
    54735475    precedence[TOKstring] = PREC_primary; 
    54745476    precedence[TOKarrayliteral] = PREC_primary; 
    54755477    precedence[TOKtypeid] = PREC_primary; 
    54765478    precedence[TOKis] = PREC_primary; 
    54775479    precedence[TOKassert] = PREC_primary; 
    54785480    precedence[TOKfunction] = PREC_primary; 
    54795481    precedence[TOKvar] = PREC_primary; 
    54805482#if DMDV2 
    54815483    precedence[TOKdefault] = PREC_primary; 
    54825484#endif 
  • branches/dmd-1.x/src/parse.h

    r585 r588  
    148148enum PREC 
    149149{ 
    150150    PREC_zero, 
    151151    PREC_expr, 
    152152    PREC_assign, 
    153153    PREC_cond, 
    154154    PREC_oror, 
    155155    PREC_andand, 
    156156    PREC_or, 
    157157    PREC_xor, 
    158158    PREC_and, 
    159159    PREC_equal, 
    160160    PREC_rel, 
    161161    PREC_shift, 
    162162    PREC_add, 
    163163    PREC_mul, 
    164164    PREC_unary, 
    165165    PREC_primary, 
    166166}; 
    167167 
    168 enum PREC precedence[TOKMAX]; 
     168extern enum PREC precedence[TOKMAX]; 
    169169 
    170170void initPrecedence(); 
    171171 
    172172#endif /* DMD_PARSE_H */ 
  • trunk/src/backend/gother.c

    r490 r588  
    11// Copyright (C) 1986-1998 by Symantec 
    2 // Copyright (C) 2000-2009 by Digital Mars 
     2// Copyright (C) 2000-2010 by Digital Mars 
    33// All Rights Reserved 
    44// http://www.digitalmars.com 
    55// Written by Walter Bright 
    66/* 
    77 * This source file is made available for personal use 
    88 * only. The license is in /dmd/src/dmd/backendlicense.txt 
    99 * or /dm/src/dmd/backendlicense.txt 
    1010 * For any other uses, please contact Digital Mars. 
    1111 */ 
    1212 
    1313#if (SCPP || MARS) && !HTOD 
    1414 
    1515#include        <stdio.h> 
    1616#include        <time.h> 
    1717 
    1818#include        "cc.h" 
    1919#include        "global.h" 
    2020#include        "el.h" 
    2121#include        "go.h" 
    2222#include        "oper.h" 
     
    463463 
    464464    //printf("checkprop: "); WReqn(n); printf("\n"); 
    465465    assert(n && n->Eoper == OPvar); 
    466466    elem_debug(n); 
    467467    sv = n->EV.sp.Vsym; 
    468468    assert(sytab[sv->Sclass] & SCRD); 
    469469    nty = n->Ety; 
    470470    if (!tyscalar(nty)) 
    471471        goto noprop; 
    472472    nsize = size(nty); 
    473473    noff = n->EV.sp.Voffset; 
    474474    unambig = sv->Sflags & SFLunambig; 
    475475    for (l = rdlist; l; l = list_next(l)) 
    476476    {   elem *d = (elem *) list_ptr(l); 
    477477 
    478478        elem_debug(d); 
    479479 
    480480        //printf("\trd: "); WReqn(d); printf("\n"); 
    481481        if (d->Eoper == OPasm)          /* OPasm elems ruin everything  */ 
    482482            goto noprop; 
     483#if 0 
     484        // Runs afoul of Buzilla 4506 
    483485        if (OTassign(d->Eoper) && EBIN(d))      // if assignment elem 
     486#else 
     487        if (OTassign(d->Eoper))      // if assignment elem 
     488#endif 
    484489        {   elem *t = Elvalue(d); 
    485490 
    486491            if (t->Eoper == OPvar) 
    487492            {   assert(t->EV.sp.Vsym == sv); 
    488493 
    489494                if (d->Eoper == OPstreq || 
    490495                    !tyscalar(t->Ety)) 
    491496                    goto noprop;        // not worth bothering with these cases 
    492497 
    493498                /* Everything must match or we must skip this variable  */ 
    494499                /* (in case of assigning to overlapping unions, etc.)   */ 
    495500                if (t->EV.sp.Voffset != noff || 
    496501                    /* If sizes match, we are ok        */ 
    497502                    size(t->Ety) != nsize && 
    498503                        !(d->E2->Eoper == OPconst && size(t->Ety) > nsize && !tyfloating(d->E2->Ety))) 
    499504                    goto noprop; 
    500505            } 
    501506            else 
    502507            {   if (unambig)            /* unambiguous assignments only */ 
    503508                    continue;