diff --git a/core/Addfunc.cc b/core/Addfunc.cc
index febf73a08463ada7ad5cada208556f14760166e8..31b9fa9d40138bc73cbfa8b4afc9febd0da4cbb2 100644
--- a/core/Addfunc.cc
+++ b/core/Addfunc.cc
@@ -2519,7 +2519,7 @@ UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value, int idx,
     }
     else {
       // operand types mismatch => copy parts inefficiently, character by character
-      size_t i;
+      int i;
       for (i = 0; i < idx; ++i) {
         ret_val[i] = value[i];
       }