+2020-08-12  Luis Machado  <luis.machado@linaro.org>
+
+       * value.c (check_type_length_before_alloc): Use ULONGEST to store a
+       type's length.
+       Use %s and pulongest to print the length.
+
 2020-08-12  Pedro Alves  <palves@redhat.com>
 
        * NEWS: Move "Multi-target debugging support" item to the
 
 static void
 check_type_length_before_alloc (const struct type *type)
 {
-  unsigned int length = TYPE_LENGTH (type);
+  ULONGEST length = TYPE_LENGTH (type);
 
   if (max_value_size > -1 && length > max_value_size)
     {
       if (type->name () != NULL)
-       error (_("value of type `%s' requires %u bytes, which is more "
-                "than max-value-size"), type->name (), length);
+       error (_("value of type `%s' requires %s bytes, which is more "
+                "than max-value-size"), type->name (), pulongest (length));
       else
-       error (_("value requires %u bytes, which is more than "
-                "max-value-size"), length);
+       error (_("value requires %s bytes, which is more than "
+                "max-value-size"), pulongest (length));
     }
 }