diff --git a/time/tzfile.c b/time/tzfile.c
index 0ee70fd356..bed62d877f 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -643,12 +643,10 @@ __tzfile_compute (__time64_t timer, int use_localtime,
 		  int *leap_correct, bool *leap_hit,
 		  struct tm *tp)
 {
-  tzidx i;
-
   /* Find the last leap second correction transition time before TIMER.  */
   int corr = 0;
   bool hit = false;
-  for (i = leapcnt; 0 < i; )
+  for (tzidx i = leapcnt; 0 < i; )
     {
       i--;
       if (leaps[i].occur <= timer)
@@ -679,7 +677,7 @@ __tzfile_compute (__time64_t timer, int use_localtime,
     }
   else
     {
-      i = first_transition_after (timer);
+      tzidx i = first_transition_after (timer);
       if (i == timecnt)
 	{
 	  /* TIMER is after the last transition, or there are no transitions
