From: drh Date: Wed, 19 Mar 2014 16:56:58 +0000 (+0000) Subject: Fix a problem in the block-sort logic that can arise if the VDBE opcode X-Git-Tag: version-3.8.5~109^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26d7e7c6b7dd234b5ae4cf6dd4ce96ed98b078c7;p=thirdparty%2Fsqlite.git Fix a problem in the block-sort logic that can arise if the VDBE opcode array is resized while the block-sort logic is being coded. "make test" now runs to completion, though there are still 17 failures. FossilOrigin-Name: 62f3a22050e0f11c789374f8a3785df0a84c24cb --- diff --git a/manifest b/manifest index 34c7b8395d..2fa2da7098 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sreusing\stemporary\sregisters\sin\sco-routines\swhen\sdoing\nblock-sorting. -D 2014-03-19T15:17:24.171 +C Fix\sa\sproblem\sin\sthe\sblock-sort\slogic\sthat\scan\sarise\sif\sthe\sVDBE\sopcode\narray\sis\sresized\swhile\sthe\sblock-sort\slogic\sis\sbeing\scoded.\s\s"make\stest"\nnow\sruns\sto\scompletion,\sthough\sthere\sare\sstill\s17\sfailures. +D 2014-03-19T16:56:58.204 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -217,7 +217,7 @@ F src/printf.c e5a0005f8b3de21f85da6a709d2fbee76775bf4b F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0 -F src/select.c 45d3ac1273b15e98f94c261bd40eb54a8eff0ac7 +F src/select.c 0c5df3eb627983064207c543db7d46fc960ca3a4 F src/shell.c bab4de12b441369491812ecc93212ff4deda68fa F src/sqlite.h.in a2ef671f92747a5a1c8a47bad5c585a8dd9eca80 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e @@ -1156,7 +1156,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P b186d8d15a10d5e8fcae9ae72e8624d71831f5bd -R b0910f2ab36ae08486561cabd81d63b0 +P 463d921b519b08648a715e987c430f06b06bae84 +R 0046fa449ec804e57106e3417f064519 U drh -Z 0471d95e83a3c5ea30582909f120da3f +Z 208b34a8fc9197aeefd7f546d5d68bb0 diff --git a/manifest.uuid b/manifest.uuid index 6cd642341c..9945baac14 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -463d921b519b08648a715e987c430f06b06bae84 \ No newline at end of file +62f3a22050e0f11c789374f8a3785df0a84c24cb \ No newline at end of file diff --git a/src/select.c b/src/select.c index 087cd401f0..ca54ae635f 100644 --- a/src/select.c +++ b/src/select.c @@ -482,16 +482,16 @@ static void pushOntoSorter( VdbeOp *pOp; /* Opcode that opens the sorter */ int nKey; /* Number of sorting key columns, including OP_Sequence */ + regPrevKey = pParse->nMem+1; + pParse->nMem += pSort->nOBSat; + nKey = nExpr - pSort->nOBSat + 1; addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr); VdbeCoverage(v); + sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat); pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex); pOp->opcode = OP_OpenEphemeral; pSort->sortFlags &= ~SORTFLAG_UseSorter; - nKey = nExpr - pSort->nOBSat + 1; pOp->p2 = nKey + 1; - regPrevKey = pParse->nMem+1; - pParse->nMem += pSort->nOBSat; - sqlite3VdbeAddOp4(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat, - (char*)pOp->p4.pKeyInfo, P4_KEYINFO); + sqlite3VdbeChangeP4(v, -1, (char*)pOp->p4.pKeyInfo, P4_KEYINFO); pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat, 1); addrJmp = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);