PR gdb/10728
[deliverable/binutils-gdb.git] / gdb / valarith.c
index ed76b0960ba73b8450083451e6b56e9805fa676a..c87bc6f255e55cbf44f45d0a716d8e74360f98f7 100644 (file)
@@ -122,6 +122,13 @@ First argument of `-' is a pointer and second argument is neither\n\
 an integer nor a pointer of the same type."));
 
   sz = TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)));
+  if (sz == 0) 
+    {
+      warning (_("Type size unknown, assuming 1. "
+               "Try casting to a known type, or void *."));
+      sz = 1;
+    }
+
   return (value_as_long (arg1) - value_as_long (arg2)) / sz;
 }
 
This page took 0.023896 seconds and 4 git commands to generate.