/ Check-in [3fd6c72d]
Login

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

Overview
Comment:When building in debug mode with gcc, force the nullMem variable in function columnMem() to be aligned to an 8-byte boundary. Otherwise an assert() statement may fail. (CVS 6723)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3fd6c72da599347af70897b30b86a4ba641d4cd9
User & Date: danielk1977 2009-06-06 14:13:27
Context
2009-06-06
15:17
Make sure the result of sqlite3VdbeGetOp() is not used as an array following an OOM error, since after (6691) it might be a single-entry dummy opcode. (CVS 6724) check-in: 127b1398 user: drh tags: trunk
14:13
When building in debug mode with gcc, force the nullMem variable in function columnMem() to be aligned to an 8-byte boundary. Otherwise an assert() statement may fail. (CVS 6723) check-in: 3fd6c72d user: danielk1977 tags: trunk
2009-06-05
18:44
Detect when database corruption causes an attemp to set the pointer map value for a pointer map page and report the corruption. (CVS 6722) check-in: 3ae4880b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains code use to implement APIs that are part of the
    14     14   ** VDBE.
    15     15   **
    16         -** $Id: vdbeapi.c,v 1.164 2009/04/27 18:46:06 drh Exp $
           16  +** $Id: vdbeapi.c,v 1.165 2009/06/06 14:13:27 danielk1977 Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "vdbeInt.h"
    20     20   
    21     21   #if 0 && defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)
    22     22   /*
    23     23   ** The following structure contains pointers to the end points of a
................................................................................
   762    762   
   763    763     pVm = (Vdbe *)pStmt;
   764    764     if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){
   765    765       sqlite3_mutex_enter(pVm->db->mutex);
   766    766       vals = sqlite3_data_count(pStmt);
   767    767       pOut = &pVm->pResultSet[i];
   768    768     }else{
   769         -    /* ((double)0) In case of SQLITE_OMIT_FLOATING_POINT... */
   770         -    static const Mem nullMem = {{0}, (double)0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
          769  +    /* If the value passed as the second argument is out of range, return
          770  +    ** a pointer to the following static Mem object which contains the
          771  +    ** value SQL NULL. Even though the Mem structure contains an element
          772  +    ** of type i64, on certain architecture (x86) with certain compiler
          773  +    ** switches (-Os), gcc may align this Mem object on a 4-byte boundary
          774  +    ** instead of an 8-byte one. This all works fine, except that when
          775  +    ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s
          776  +    ** that a Mem structure is located on an 8-byte boundary. To prevent
          777  +    ** this assert() from failing, when building with SQLITE_DEBUG defined
          778  +    ** using gcc, force nullMem to be 8-byte aligned using the magical
          779  +    ** __attribute__((aligned(8))) macro.  */
          780  +    static const Mem nullMem 
          781  +#if defined(SQLITE_DEBUG) && defined(__GNUC__)
          782  +      __attribute__((aligned(8))) 
          783  +#endif
          784  +      = {{0}, (double)0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
          785  +
   771    786       if( pVm && ALWAYS(pVm->db) ){
   772    787         sqlite3_mutex_enter(pVm->db->mutex);
   773    788         sqlite3Error(pVm->db, SQLITE_RANGE, 0);
   774    789       }
   775    790       pOut = (Mem*)&nullMem;
   776    791     }
   777    792     return pOut;