diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c
index 49735bc06a..5d5468a13e 100644
--- a/src/backend/tsearch/spell.c
+++ b/src/backend/tsearch/spell.c
@@ -1710,7 +1710,6 @@ void
 NISortDictionary(IspellDict *Conf)
 {
 	int			i;
-	int			naffix = 0;
 	int			curaffix;
 
 	/* compress affixes */
@@ -1760,6 +1759,8 @@ NISortDictionary(IspellDict *Conf)
 	/* Otherwise fill Conf->AffixData here */
 	else
 	{
+	    int			naffix;
+		
 		/* Count the number of different flags used in the dictionary */
 		qsort((void *) Conf->Spell, Conf->nspell, sizeof(SPELL *),
 			  cmpspellaffix);