diff --git a/src/array.c b/src/array.c
index f7b1fd423f1292169ff27adb5307e78416e1dd7e..36133b81a76c4b081e8fc12b4cb48de03014baaa 100644
--- a/src/array.c
+++ b/src/array.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: array.c,v 1.146 2003/04/28 18:32:38 mast Exp $
+|| $Id: array.c,v 1.147 2003/05/15 15:33:30 mast Exp $
 */
 
 #include "global.h"
@@ -26,7 +26,7 @@
 #include "cyclic.h"
 #include "multiset.h"
 
-RCSID("$Id: array.c,v 1.146 2003/04/28 18:32:38 mast Exp $");
+RCSID("$Id: array.c,v 1.147 2003/05/15 15:33:30 mast Exp $");
 
 PMOD_EXPORT struct array empty_array=
 {
@@ -253,24 +253,28 @@ PMOD_EXPORT struct array *array_column (struct array *data, struct svalue *index
 PMOD_EXPORT void simple_array_index_no_free(struct svalue *s,
 				struct array *a,struct svalue *ind)
 {
-  INT32 i;
   switch(ind->type)
   {
-    case T_INT:
-      i=ind->u.integer;
-      if(i<0) i+=a->size;
+    case T_INT: {
+      INT_TYPE p = ind->u.integer;
+      INT_TYPE i = p < 0 ? p + a->size : p;
       if(i<0 || i>=a->size) {
 	struct svalue tmp;
 	tmp.type=T_ARRAY;
 	tmp.u.array=a;
 	if (a->size) {
-	  index_error(0,0,0,&tmp,ind,"Index %d is out of array range 0 - %d.\n", i, a->size-1);
+	  index_error(0,0,0,&tmp,ind,
+		      "Index %"PRINTPIKEINT"d is out of array range "
+		      "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
+		      p, -a->size, a->size-1);
 	} else {
-	  index_error(0,0,0,&tmp,ind,"Attempt to index the empty array with %d.\n", i);
+	  index_error(0,0,0,&tmp,ind,
+		      "Attempt to index the empty array with %"PRINTPIKEINT"d.\n", p);
 	}
       }
       array_index_no_free(s,a,i);
       break;
+    }
 
     case T_STRING:
     {
@@ -307,20 +311,22 @@ PMOD_EXPORT void array_free_index(struct array *v,INT32 index)
 
 PMOD_EXPORT void simple_set_index(struct array *a,struct svalue *ind,struct svalue *s)
 {
-  INT32 i;
   switch (ind->type) {
-    case T_INT:
-      i=ind->u.integer;
-      if(i<0) i+=a->size;
+    case T_INT: {
+      INT_TYPE p = ind->u.integer;
+      INT_TYPE i = p < 0 ? p + a->size : p;
       if(i<0 || i>=a->size) {
 	if (a->size) {
-	  Pike_error("Index %d is out of array range 0 - %d.\n", i, a->size-1);
+	  Pike_error("Index %"PRINTPIKEINT"d is out of array range "
+		     "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
+		     p, -a->size, a->size-1);
 	} else {
-	  Pike_error("Attempt to index the empty array with %d.\n", i);
+	  Pike_error("Attempt to index the empty array with %"PRINTPIKEINT"d.\n", p);
 	}
       }
       array_set_index(a,i,s);
       break;
+    }
 
     case T_STRING:
     {
@@ -1263,18 +1269,19 @@ PMOD_EXPORT union anything *array_get_item_ptr(struct array *a,
 				   struct svalue *ind,
 				   TYPE_T t)
 {
-  INT_TYPE i;
+  INT_TYPE i, p;
   if(ind->type != T_INT)
     Pike_error("Expected integer as array index, got %s.\n",
 	       get_name_of_type (ind->type));
-  i=ind->u.integer;
-  if(i<0) i+=a->size;
+  p = ind->u.integer;
+  i = p < 0 ? p + a->size : p;
   if(i<0 || i>=a->size) {
     if (a->size) {
-      Pike_error("Index %"PRINTPIKEINT"d is out of "
-		 "array range 0 - %"PRINTPTRDIFFT"d.\n", i, a->size-1);
+      Pike_error("Index %"PRINTPIKEINT"d is out of array range "
+		 "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
+		 p, -a->size, a->size-1);
     } else {
-      Pike_error("Attempt to index the empty array with %"PRINTPIKEINT"d.\n", i);
+      Pike_error("Attempt to index the empty array with %"PRINTPIKEINT"d.\n", p);
     }
   }
   return low_array_get_item_ptr(a,i,t);
@@ -2302,7 +2309,7 @@ void gc_mark_array_as_referenced(struct array *a)
 	if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1)
 	  a->type_field = t;
 	else
-	  a->type_field |= t;
+	  a->type_field |= t;	/* There might be an additional BIT_INT. */
 
 	gc_assert_checked_as_weak(a);
       }
diff --git a/src/builtin.cmod b/src/builtin.cmod
index fe45eb91c1cb55f49cd3043a256347eacb75b8bb..4035a86b4ab7271fa618f178e68d920dbc4026ce 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: builtin.cmod,v 1.135 2003/04/28 18:32:38 mast Exp $
+|| $Id: builtin.cmod,v 1.136 2003/05/15 15:33:30 mast Exp $
 */
 
 #include "global.h"
@@ -1355,7 +1355,7 @@ PIKECLASS backtrace_frame
 
     if ((index < -numargs) || (index >= numargs)) {
 	index_error("pike_frame->`[]=", Pike_sp-args, args, NULL, Pike_sp-args,
-		    "Index %"PRINTPIKEINT"d is out of array range 0 - %d,\n",
+		    "Index %"PRINTPIKEINT"d is out of array range 0..%d,\n",
 		    index, numargs-1);
     } else if (index < 0) {
       index += numargs;
diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index e7737613dd0172cd9d879cbc42cb018677147e69..09c98760b62e77bb760e0dba05ef86727cc97c3a 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -2,11 +2,11 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: builtin_functions.c,v 1.492 2003/05/07 12:31:52 mast Exp $
+|| $Id: builtin_functions.c,v 1.493 2003/05/15 15:33:30 mast Exp $
 */
 
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.492 2003/05/07 12:31:52 mast Exp $");
+RCSID("$Id: builtin_functions.c,v 1.493 2003/05/15 15:33:30 mast Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -1261,7 +1261,7 @@ PMOD_EXPORT void f_string_to_unicode(INT32 args)
 	  }
 	  if (str2[i] > 0x10ffff) {
 	    Pike_error("string_to_unicode(): Character 0x%08x (index %ld) "
-		  "is out of range (0x00000000 - 0x0010ffff).",
+		  "is out of range (0x00000000..0x0010ffff).",
 		  str2[i], PTRDIFF_T_TO_LONG(i));
 	  }
 	  /* Extra wide characters take two unicode characters in space.
@@ -6312,7 +6312,8 @@ PMOD_EXPORT void f_object_variablep(INT32 args)
  *!
  *! @note
  *!   Elements are compared with @[`==]. They are also hashed (see
- *!   @[lfun::__hash] for further details if @[a] contains objects).
+ *!   @[lfun::__hash] for further details if the array contains
+ *!   objects).
  */
 PMOD_EXPORT void f_uniq_array(INT32 args)
 {
diff --git a/src/error.c b/src/error.c
index 44a0fc059818243c89d8a6929de97261098938c5..ee6445c4ad29fe5624761526dcfe2d3373443240 100644
--- a/src/error.c
+++ b/src/error.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: error.c,v 1.107 2003/04/28 00:34:12 mast Exp $
+|| $Id: error.c,v 1.108 2003/05/15 15:33:30 mast Exp $
 */
 
 #define NO_PIKE_SHORTHAND
@@ -23,7 +23,7 @@
 #include "threads.h"
 #include "gc.h"
 
-RCSID("$Id: error.c,v 1.107 2003/04/28 00:34:12 mast Exp $");
+RCSID("$Id: error.c,v 1.108 2003/05/15 15:33:30 mast Exp $");
 
 #undef ATTRIBUTE
 #define ATTRIBUTE(X)
@@ -525,7 +525,7 @@ static void f_error_index(INT32 args)
       break;
     default:
       index_error("error->`[]", Pike_sp-args, args, NULL, Pike_sp-args,
-		  "Index %"PRINTPIKEINT"d is out of range 0 - 1.\n", ind);
+		  "Index %"PRINTPIKEINT"d is out of range 0..1.\n", ind);
       break;
   }
 }
diff --git a/src/fd_control.c b/src/fd_control.c
index 52c941856388e9d4a45cf662e9fbef8651fc678b..5f2d8245f197cef6aefe559ba525c2e57b844891 100644
--- a/src/fd_control.c
+++ b/src/fd_control.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: fd_control.c,v 1.47 2003/04/30 10:38:31 grubba Exp $
+|| $Id: fd_control.c,v 1.48 2003/05/15 15:33:30 mast Exp $
 */
 
 #ifndef TESTING
@@ -10,7 +10,7 @@
 #include "pike_error.h"
 #include "fdlib.h"
 
-RCSID("$Id: fd_control.c,v 1.47 2003/04/30 10:38:31 grubba Exp $");
+RCSID("$Id: fd_control.c,v 1.48 2003/05/15 15:33:30 mast Exp $");
 
 #else /* TESTING */
 
@@ -79,7 +79,7 @@ PMOD_EXPORT int set_nonblocking(int fd,int which)
   int ret;
 #ifdef PIKE_DEBUG
   if(fd<0)
-    Pike_fatal("Filedescriptor %d out of range [0,inf).\n", fd);
+    Pike_fatal("File descriptor %d out of range.\n", fd);
 #endif
 
   do 
diff --git a/src/opcodes.c b/src/opcodes.c
index bd4c16be192bdca09379c096e40763ed8099f95f..e7b472306866b24a19305b88da6fae92fdc7922f 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: opcodes.c,v 1.146 2003/04/28 18:08:35 mast Exp $
+|| $Id: opcodes.c,v 1.147 2003/05/15 15:33:30 mast Exp $
 */
 
 #include "global.h"
@@ -30,7 +30,7 @@
 
 #define sp Pike_sp
 
-RCSID("$Id: opcodes.c,v 1.146 2003/04/28 18:08:35 mast Exp $");
+RCSID("$Id: opcodes.c,v 1.147 2003/05/15 15:33:30 mast Exp $");
 
 void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
 {
@@ -92,16 +92,17 @@ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
   case T_STRING:
     if(ind->type==T_INT)
     {
-      INT_TYPE i=ind->u.integer;
-      if(i<0)
-	i+=what->u.string->len;
-      if(i<0 || i>=what->u.string->len)
+      ptrdiff_t len = what->u.string->len;
+      INT_TYPE p = ind->u.integer;
+      INT_TYPE i = p < 0 ? p + len : p;
+      if(i<0 || i>=len)
       {
-	if(what->u.string->len == 0)
+	if(len == 0)
 	  Pike_error("Attempt to index the empty string with %"PRINTPIKEINT"d.\n", i);
 	else
 	  Pike_error("Index %"PRINTPIKEINT"d is out of string range "
-		     "0 - %"PRINTPTRDIFFT"d.\n", i, what->u.string->len - 1);
+		     "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
+		     i, -len, len - 1);
       } else
 	i=index_shared_string(what->u.string,i);
       to->type=T_INT;
diff --git a/src/operators.c b/src/operators.c
index ebd02e798a86d767f4dc41e1eedf85a1f25304ca..b5e01bada1eb39057f7e0337e51abf99daf1a3d0 100644
--- a/src/operators.c
+++ b/src/operators.c
@@ -2,12 +2,12 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: operators.c,v 1.178 2003/05/15 15:10:56 mast Exp $
+|| $Id: operators.c,v 1.179 2003/05/15 15:33:30 mast Exp $
 */
 
 #include "global.h"
 #include <math.h>
-RCSID("$Id: operators.c,v 1.178 2003/05/15 15:10:56 mast Exp $");
+RCSID("$Id: operators.c,v 1.179 2003/05/15 15:33:30 mast Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "multiset.h"
@@ -3538,7 +3538,7 @@ static void f_string_assignment_index(INT32 args)
   get_all_args("string[]",args,"%i",&p);
   i = p < 0 ? p + len : p;
   if(i<0 || i>=len)
-    Pike_error("String index %"PRINTPIKEINT"d is out of range "
+    Pike_error("Index %"PRINTPIKEINT"d is out of string range "
 	       "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
 	       p, -len, len - 1);
   else
@@ -3564,7 +3564,7 @@ static void f_string_assignment_assign_index(INT32 args)
     len = u->string->len;
     i = p < 0 ? p + len : p;
     if(i<0 || i>=len)
-      Pike_error("String index %"PRINTPIKEINT"d is out of range "
+      Pike_error("Index %"PRINTPIKEINT"d is out of string range "
 		 "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
 		 p, -len, len - 1);
     free_string(THIS->s);
@@ -3580,7 +3580,7 @@ static void f_string_assignment_assign_index(INT32 args)
     len = sp[-1].u.string->len;
     i = p < 0 ? p + len : p;
     if(i<0 || i>=len)
-      Pike_error("String index %"PRINTPIKEINT"d is out of range "
+      Pike_error("Index %"PRINTPIKEINT"d is out of string range "
 		 "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n",
 		 p, -len, len - 1);
     sp[-1].u.string=modify_shared_string(sp[-1].u.string,i,j);
diff --git a/src/stralloc.c b/src/stralloc.c
index 8dfb1f75f2309cccf82d9b6eda4e37b8e4476c2f..5fedb989bec9eb0dae162fca5c29f0fb2f7c6c0f 100644
--- a/src/stralloc.c
+++ b/src/stralloc.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: stralloc.c,v 1.155 2003/04/07 15:28:47 mast Exp $
+|| $Id: stralloc.c,v 1.156 2003/05/15 15:33:31 mast Exp $
 */
 
 #include "global.h"
@@ -24,7 +24,7 @@
 #include <ctype.h>
 #include <math.h>
 
-RCSID("$Id: stralloc.c,v 1.155 2003/04/07 15:28:47 mast Exp $");
+RCSID("$Id: stralloc.c,v 1.156 2003/05/15 15:33:31 mast Exp $");
 
 /* #define STRALLOC_USE_PRIMES */
 
@@ -167,12 +167,12 @@ PMOD_EXPORT INLINE unsigned INT32 index_shared_string(struct pike_string *s,
 #ifdef PIKE_DEBUG
   if(pos > s->len || pos<0) {
     if (s->len) {
-      Pike_fatal("String index %ld is out of range [0 - %ld]!\n",
-	    DO_NOT_WARN((long)pos),
-	    DO_NOT_WARN((long)s->len-1));
+      Pike_fatal("String index %"PRINTPTRDIFFT"d is out of "
+		 "range 0..%"PRINTPTRDIFFT"d.\n",
+		 pos, s->len-1);
     } else {
-      Pike_fatal("Attempt to index the empty string with %ld!\n",
-	    DO_NOT_WARN((long)pos));
+      Pike_fatal("Attempt to index the empty string with %"PRINTPTRDIFFT"d.\n",
+		 pos);
     }
   }
 #endif
@@ -183,9 +183,17 @@ PMOD_EXPORT INLINE void low_set_index(struct pike_string *s, ptrdiff_t pos,
 				      int value)
 {
 #ifdef PIKE_DEBUG
-  if(pos > s->len || pos<0)
-    Pike_fatal("string index out of range!\n");
-  
+  if(pos > s->len || pos<0) {
+    if (s->len) {
+      Pike_fatal("String index %"PRINTPTRDIFFT"d is out of "
+		 "range 0..%"PRINTPTRDIFFT"d.\n",
+		 pos, s->len-1);
+    } else {
+      Pike_fatal("Attempt to index the empty string with %"PRINTPTRDIFFT"d.\n",
+		 pos);
+    }
+  }
+
   if(pos == s->len && value)
     Pike_fatal("string zero termination foul!\n");
 #endif