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)

FossilOrigin-Name: 3fd6c72da599347af70897b30b86a4ba641d4cd9
This commit is contained in:
danielk1977 2009-06-06 14:13:26 +00:00
parent acfc72bea4
commit 41f5b04ceb
3 changed files with 26 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Detect\swhen\sdatabase\scorruption\scauses\san\sattemp\sto\sset\sthe\spointer\smap\nvalue\sfor\sa\spointer\smap\spage\sand\sreport\sthe\scorruption.\s(CVS\s6722)
D 2009-06-05T18:44:15
C When\sbuilding\sin\sdebug\smode\swith\sgcc,\sforce\sthe\snullMem\svariable\sin\sfunction\scolumnMem()\sto\sbe\saligned\sto\san\s8-byte\sboundary.\sOtherwise\san\sassert()\sstatement\smay\sfail.\s(CVS\s6723)
D 2009-06-06T14:13:27
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 8b8fb7823264331210cddf103831816c286ba446
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -206,7 +206,7 @@ F src/vacuum.c 0e14f371ea3326c6b8cfba257286d798cd20db59
F src/vdbe.c 434e3803de90697cfa6cc53f0f6719a575cde107
F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a
F src/vdbeInt.h 3727128255a93d116e454f67d4559700f7ae4d6f
F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed
F src/vdbeapi.c 619992b16821b989050e8a12e259d795d30731a9
F src/vdbeaux.c 78ff6c355ccc2d211350f507bccfcd95118169e8
F src/vdbeblob.c c25d7e7bc6d5917feeb17270bd275fa771f26e5c
F src/vdbemem.c 05183d46094aa99b8f8350e5761b9369dbef35a8
@ -733,7 +733,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 1fef16ec2b89981770cf44f606a420fbe031a7a4
R 731fb18497d10f8868219b8baf21403e
U drh
Z b3f6798c73dec5beaf284b9c4bf80ed6
P 3ae4880bee3a0312c61cdd36f4fa50286cc2ef48
R 7fafa9b9c2ade168b25ec9e70190e435
U danielk1977
Z 310a5ca4b45740577b9f82dfb2f7878d

View File

@ -1 +1 @@
3ae4880bee3a0312c61cdd36f4fa50286cc2ef48
3fd6c72da599347af70897b30b86a4ba641d4cd9

View File

@ -13,7 +13,7 @@
** This file contains code use to implement APIs that are part of the
** VDBE.
**
** $Id: vdbeapi.c,v 1.164 2009/04/27 18:46:06 drh Exp $
** $Id: vdbeapi.c,v 1.165 2009/06/06 14:13:27 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@ -766,8 +766,23 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
vals = sqlite3_data_count(pStmt);
pOut = &pVm->pResultSet[i];
}else{
/* ((double)0) In case of SQLITE_OMIT_FLOATING_POINT... */
static const Mem nullMem = {{0}, (double)0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
/* If the value passed as the second argument is out of range, return
** a pointer to the following static Mem object which contains the
** value SQL NULL. Even though the Mem structure contains an element
** of type i64, on certain architecture (x86) with certain compiler
** switches (-Os), gcc may align this Mem object on a 4-byte boundary
** instead of an 8-byte one. This all works fine, except that when
** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s
** that a Mem structure is located on an 8-byte boundary. To prevent
** this assert() from failing, when building with SQLITE_DEBUG defined
** using gcc, force nullMem to be 8-byte aligned using the magical
** __attribute__((aligned(8))) macro. */
static const Mem nullMem
#if defined(SQLITE_DEBUG) && defined(__GNUC__)
__attribute__((aligned(8)))
#endif
= {{0}, (double)0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
if( pVm && ALWAYS(pVm->db) ){
sqlite3_mutex_enter(pVm->db->mutex);
sqlite3Error(pVm->db, SQLITE_RANGE, 0);