We've run into an alignment issue in SQLite 3.6.14.2 which only seems to cause a problem under Solaris Sparc in our testing.
Failure narrowed down to: src/rowset.c:186 pEntry->v = rowid pEntry is 0xXXXXX4 __alignof(*pEntry) is 8 (because of an i64) However sizeof(RowSet) is 28 (and 28%8 = 4), and pEntry starts 1 RowSet after freshly allocated, 8-bytes aligned) memory (see sqlite3RowSetInit) So it crashes. This is definitely a bug in sqlite. Suggested patch that seems to work for us: ===== sqlite/src/rowset.c 1.1 vs edited ===== --- 1.1/sqlite/src/rowset.c 2009-05-19 14:07:53 -07:00 +++ edited/sqlite/src/rowset.c 2009-05-26 15:43:56 -07:00 @@ -127,6 +127,7 @@ */ RowSet *sqlite3RowSetInit(sqlite3 *db, void *pSpace, unsigned int N){ RowSet *p; + int n; assert( N >= sizeof(*p) ); p = pSpace; p->pChunk = 0; @@ -134,8 +135,14 @@ p->pEntry = 0; p->pLast = 0; p->pTree = 0; - p->pFresh = (struct RowSetEntry*)&p[1]; - p->nFresh = (u16)((N - sizeof(*p))/sizeof(struct RowSetEntry)); + /* Alignment must be a power of 2, and at least equal to + __alignof(struct RowSetEntry) */ + #define MIN_ALIGNMENT 8 + n = sizeof(*p); + /* Round up to next alignment */ + n = (n - 1) / MIN_ALIGNMENT * MIN_ALIGNMENT + MIN_ALIGNMENT; + p->pFresh = (struct RowSetEntry*)((char *)p + n); + p->nFresh = (u16)((N - n)/sizeof(struct RowSetEntry)); p->isSorted = 1; p->iBatch = 0; return p; _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users