/ Check-in [635933b1]
Login

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

Overview
Comment:Two if statements should be asserts. GCC was silently ignoring them, hence the problem did not show up in coverage testing. Ticket #3333. (CVS 5607)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 635933b1cae6c43656260555089952e2925c3292
User & Date: drh 2008-08-25 12:08:22
Context
2008-08-25
12:14
Additional coverage testing in the new name resolver module. (CVS 5608) check-in: 0d61960a user: drh tags: trunk
12:08
Two if statements should be asserts. GCC was silently ignoring them, hence the problem did not show up in coverage testing. Ticket #3333. (CVS 5607) check-in: 635933b1 user: drh tags: trunk
11:57
Fix a segfault that can occur when running integrity_check on a corrupt db. (CVS 5606) check-in: eae959ed user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is responsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.320 2008/08/20 16:35:10 drh Exp $
           19  +** $Id: where.c,v 1.321 2008/08/25 12:08:22 drh Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
    25     25   */
    26     26   #define BMS  (sizeof(Bitmask)*8)
................................................................................
  1282   1282       int nTerm;
  1283   1283       WHERETRACE(("Recomputing index info for %s...\n", pTab->zName));
  1284   1284   
  1285   1285       /* Count the number of possible WHERE clause constraints referring
  1286   1286       ** to this virtual table */
  1287   1287       for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
  1288   1288         if( pTerm->leftCursor != pSrc->iCursor ) continue;
  1289         -      if( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
         1289  +      assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
  1290   1290         testcase( pTerm->eOperator==WO_IN );
  1291   1291         testcase( pTerm->eOperator==WO_ISNULL );
  1292   1292         if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
  1293   1293         nTerm++;
  1294   1294       }
  1295   1295   
  1296   1296       /* If the ORDER BY clause contains only columns in the current 
................................................................................
  1332   1332       *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint = pIdxCons;
  1333   1333       *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy;
  1334   1334       *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage =
  1335   1335                                                                        pUsage;
  1336   1336   
  1337   1337       for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
  1338   1338         if( pTerm->leftCursor != pSrc->iCursor ) continue;
  1339         -      if( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
         1339  +      assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
  1340   1340         testcase( pTerm->eOperator==WO_IN );
  1341   1341         testcase( pTerm->eOperator==WO_ISNULL );
  1342   1342         if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
  1343   1343         pIdxCons[j].iColumn = pTerm->leftColumn;
  1344   1344         pIdxCons[j].iTermOffset = i;
  1345   1345         pIdxCons[j].op = pTerm->eOperator;
  1346   1346         /* The direct assignment in the previous line is possible only because