aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 88a42d3..1b63343 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1,6 +1,6 @@
/* Perform non-arithmetic operations on values, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1695,6 +1695,9 @@ value_array (int lowbound, gdb::array_view<struct value *> elemvec)
/* Validate that the bounds are reasonable and that each of the
elements have the same size. */
+ if (elemvec.empty ())
+ error (_("size of the array element must not be zero"));
+
typelength = type_length_units (elemvec[0]->enclosing_type ());
for (struct value *other : elemvec.slice (1))
{