Fix a register allocation bug in the VDBE code generator for
PRAGMA integrity_check;
FossilOrigin-Name: 88439a866b3b16ad7c308ebe59198662a05e7eeb
diff --git a/src/expr.c b/src/expr.c
index 352edc5..998c94f 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -4251,3 +4251,26 @@
pParse->nTempReg = 0;
pParse->nRangeReg = 0;
}
+
+/*
+** Validate that no temporary register falls within the range of
+** iFirst..iLast, inclusive. This routine is only call from within assert()
+** statements.
+*/
+#ifdef SQLITE_DEBUG
+int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){
+ int i;
+ if( pParse->nRangeReg>0
+ && pParse->iRangeReg+pParse->nRangeReg<iLast
+ && pParse->iRangeReg>=iFirst
+ ){
+ return 0;
+ }
+ for(i=0; i<pParse->nTempReg; i++){
+ if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif /* SQLITE_DEBUG */