aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-12-21 08:24:18 -0700
committerTom Tromey <tromey@adacore.com>2024-02-05 07:13:37 -0700
commita8b1650962b074fb8025399199f50abc65090670 (patch)
tree8044b7d9173494fd688d50e0c2a78f62848dcab1 /gdb/f-lang.c
parentbae2a57f4c07f46093e7bf00fec2554868e77189 (diff)
downloadgdb-a8b1650962b074fb8025399199f50abc65090670.zip
gdb-a8b1650962b074fb8025399199f50abc65090670.tar.gz
gdb-a8b1650962b074fb8025399199f50abc65090670.tar.bz2
Handling of arrays with optimized-out bounds
In Ada, sometimes the compiler must emit array bounds by referencing an artificial variable that's created for this purpose. However, with optimization enabled, these variables can be optimized away. Currently this can result in displays like: (gdb) print mumble $1 = (warning: unable to get bounds of array, assuming null array ) This patch changes this to report that the array is optimized-out, instead, which is closer to the truth, and more generally useful. For example, Python pretty-printers can now recognize this situation. In order to accomplish this, I introduced a new PROP_OPTIMIZED_OUT enumerator and changed one place to use it. Reusing the "unknown" state wouldn't work properly, because in C it is normal for array bounds to be unknown.
Diffstat (limited to 'gdb/f-lang.c')
-rw-r--r--gdb/f-lang.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index d573c4f..96d4ed8 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1372,7 +1372,7 @@ fortran_undetermined::value_subarray (value *array,
have a known upper bound, so don't error check in that
situation. */
if (index < lb
- || (dim_type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED
+ || (dim_type->index_type ()->bounds ()->high.is_available ()
&& index > ub)
|| (array->lval () != lval_memory
&& dim_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED))