SQLite

Check-in [6099c180db]
Login

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

Overview
Comment:Fix more unreachable branches.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | rowvalue
Files: files | file ages | folders
SHA1: 6099c180db55396d6307538a5428ae5ef1b82d10
User & Date: drh 2016-08-24 17:49:07.427
Context
2016-08-24
18:51
In sqlite3FindInIndex(), improve internal comments and avoid an unreachable branch. (check-in: 55945fc12f user: drh tags: rowvalue)
17:49
Fix more unreachable branches. (check-in: 6099c180db user: drh tags: rowvalue)
15:37
Add a NEVER() on an unreachable branch in comparisonAffinity(). (check-in: 505a2f20ea user: drh tags: rowvalue)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
538
539
540
541
542
543
544
545
546
547
548

549
550
551
552
553
554
555
    p5 |= SQLITE_STOREP2;
    if( opx==TK_LE ) opx = TK_LT;
    if( opx==TK_GE ) opx = TK_GT;

    regLeft = exprCodeSubselect(pParse, pLeft);
    regRight = exprCodeSubselect(pParse, pRight);

    for(i=0; i<nLeft; i++){
      int regFree1 = 0, regFree2 = 0;
      Expr *pL, *pR; 
      int r1, r2;

      if( i>0 ) sqlite3ExprCachePush(pParse);
      r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
      r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
      codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);
      testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
      testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
      testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);







|



>







538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
    p5 |= SQLITE_STOREP2;
    if( opx==TK_LE ) opx = TK_LT;
    if( opx==TK_GE ) opx = TK_GT;

    regLeft = exprCodeSubselect(pParse, pLeft);
    regRight = exprCodeSubselect(pParse, pRight);

    for(i=0; 1 /*Loop exits by "break"*/; i++){
      int regFree1 = 0, regFree2 = 0;
      Expr *pL, *pR; 
      int r1, r2;
      assert( i>=0 && i<nLeft );
      if( i>0 ) sqlite3ExprCachePush(pParse);
      r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
      r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
      codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);
      testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
      testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
      testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
1486
1487
1488
1489
1490
1491
1492


1493
1494
1495
1496
1497
1498
1499
1500
  IdList *pColumns,      /* List of names of LHS of the assignment */
  Expr *pExpr            /* Vector expression to be appended. Might be NULL */
){
  sqlite3 *db = pParse->db;
  int n;
  int i;
  int iFirst = pList ? pList->nExpr : 0;


  if( pColumns==0 ) goto vector_append_error;
  if( pExpr==0 ) goto vector_append_error;
  n = sqlite3ExprVectorSize(pExpr);
  if( pColumns->nId!=n ){
    sqlite3ErrorMsg(pParse, "%d columns assigned %d values",
                    pColumns->nId, n);
    goto vector_append_error;
  }







>
>
|







1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
  IdList *pColumns,      /* List of names of LHS of the assignment */
  Expr *pExpr            /* Vector expression to be appended. Might be NULL */
){
  sqlite3 *db = pParse->db;
  int n;
  int i;
  int iFirst = pList ? pList->nExpr : 0;
  /* pColumns can only be NULL due to an OOM but an OOM will cause an
  ** exit prior to this routine being invoked */
  if( NEVER(pColumns==0) ) goto vector_append_error;
  if( pExpr==0 ) goto vector_append_error;
  n = sqlite3ExprVectorSize(pExpr);
  if( pColumns->nId!=n ){
    sqlite3ErrorMsg(pParse, "%d columns assigned %d values",
                    pColumns->nId, n);
    goto vector_append_error;
  }