diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c
index 20066c4dbba882725d6f8f8397b8c3656c15d606..cf144839dd1261d6b1a0d6bc15c4afefcda332b9 100644
--- a/storage/myisam/rt_index.c
+++ b/storage/myisam/rt_index.c
@@ -973,7 +973,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
           }
           if (res)
           {
-            int j;
+            ulong j;
             DBUG_PRINT("rtree", ("root has been split, adjust levels"));
             for (j= i; j < ReinsertList.n_pages; j++)
             {