summaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 7858f91d0de..f88701faee8 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -202,7 +202,10 @@ value_subscript (struct value *array, struct value *idx)
LONGEST index = value_as_long (idx);
if (index >= lowerbound && index <= upperbound)
return value_subscripted_rvalue (array, idx, lowerbound);
- warning ("array or string index out of range");
+ /* Emit warning unless we have an array of unknown size.
+ An array of unknown size has lowerbound 0 and upperbound -1. */
+ if (upperbound > -1)
+ warning ("array or string index out of range");
/* fall doing C stuff */
c_style = 1;
}