/ Check-in [ff49a5f0]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tweaks to help facilitate structural test coverage.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-b351d95f9c
Files: files | file ages | folders
SHA1: ff49a5f00b3aa83bdacc95a32d60527c740a6c09
User & Date: drh 2010-09-28 06:00:48
Context
2010-09-28
07:11
Replace some unreachable branch instructions with assert() statements. Closed-Leaf check-in: 88b84bf1 user: drh tags: bug-b351d95f9c
06:00
Tweaks to help facilitate structural test coverage. check-in: ff49a5f0 user: drh tags: bug-b351d95f9c
04:14
Test case and fix for the specific failure of ticket [b351d95f9cd5ef17e9d9dbae]. check-in: 57789cfe user: drh tags: bug-b351d95f9c
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  3048   3048     int target,        /* Where to write results */
  3049   3049     int doHardCopy     /* Make a hard copy of every element */
  3050   3050   ){
  3051   3051     struct ExprList_item *pItem;
  3052   3052     int i, n;
  3053   3053     assert( pList!=0 );
  3054   3054     assert( target>0 );
         3055  +  assert( pParse->pVdbe || pParse->db->mallocFailed );
         3056  +  if( pParse->pVdbe==0 ) return 0;
  3055   3057     n = pList->nExpr;
  3056   3058     for(pItem=pList->a, i=0; i<n; i++, pItem++){
  3057   3059       Expr *pExpr = pItem->pExpr;
  3058   3060       int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
  3059         -    assert( pParse->pVdbe || pParse->db->mallocFailed );
  3060         -    if( inReg!=target+i && pParse->pVdbe ){
         3061  +    if( inReg!=target+i ){
  3061   3062         sqlite3VdbeAddOp2(pParse->pVdbe, doHardCopy ? OP_Copy : OP_SCopy,
  3062   3063                           inReg, target+i);
  3063   3064       }
  3064   3065     }
  3065   3066     return n;
  3066   3067   }
  3067   3068   

Changes to src/vdbe.c.

  1139   1139     ** and have an assigned type.  The results are de-ephemeralized as
  1140   1140     ** as side effect.
  1141   1141     */
  1142   1142     pMem = p->pResultSet = &aMem[pOp->p1];
  1143   1143     for(i=0; i<pOp->p2; i++){
  1144   1144       assert( memIsValid(&pMem[i]) );
  1145   1145       Deephemeralize(&pMem[i]);
         1146  +    assert( (pMem[i].flags & MEM_Ephem)==0
         1147  +            || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 );
  1146   1148       sqlite3VdbeMemNulTerminate(&pMem[i]);
  1147   1149       sqlite3VdbeMemStoreType(&pMem[i]);
  1148   1150       REGISTER_TRACE(pOp->p1+i, &pMem[i]);
  1149   1151     }
  1150   1152     if( db->mallocFailed ) goto no_mem;
  1151   1153   
  1152   1154     /* Return SQLITE_ROW