Fix for ticket #3887.  Other unrelated bits of code cleanup in the expr.c
source module. (CVS 6693)

FossilOrigin-Name: 00e7250f11e190cd915870438d172f574d110e6d
diff --git a/src/expr.c b/src/expr.c
index b9979d6..7ed6929 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.441 2009/05/29 19:00:13 drh Exp $
+** $Id: expr.c,v 1.442 2009/05/30 14:16:32 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -2403,8 +2403,8 @@
         pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr);
       }
 #endif
-      for(i=0; i<nFarg && i<32; i++){
-        if( sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
+      for(i=0; i<nFarg; i++){
+        if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
           constMask |= (1<<i);
         }
         if( (pDef->flags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){
@@ -2429,9 +2429,7 @@
     case TK_SELECT: {
       testcase( op==TK_EXISTS );
       testcase( op==TK_SELECT );
-      if( pExpr->iColumn==0 ){
-        sqlite3CodeSubselect(pParse, pExpr, 0, 0);
-      }
+      sqlite3CodeSubselect(pParse, pExpr, 0, 0);
       inReg = pExpr->iColumn;
       break;
     }