aboutsummaryrefslogtreecommitdiff
path: root/gdb/std-operator.def
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-02-09 15:46:13 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-02-10 16:03:49 +0000
commite92c8eb86dcef673652644694c832c504cf9a9a9 (patch)
treeb4fb64a5caf89a02b76743fc7f99558e39df8231 /gdb/std-operator.def
parent758f590744b1cf8d1049fca3223d1817242cacb8 (diff)
downloadgdb-e92c8eb86dcef673652644694c832c504cf9a9a9.zip
gdb-e92c8eb86dcef673652644694c832c504cf9a9a9.tar.gz
gdb-e92c8eb86dcef673652644694c832c504cf9a9a9.tar.bz2
gdb/fortran: add parser support for lbound and ubound
Add support for the LBOUND and UBOUND built in functions to the Fortran expression parser. Both support taking one or two arguments. A single argument, which must be an array, returns an array containing all of the lower or upper bound data. When passed two arguments, the second argument is the dimension being asked about. In this case the result is a scalar containing the lower or upper bound just for that dimension. Some examples of usage taken from the new test: # Given: # integer, dimension (-8:-1,-10:-2) :: neg_array # (gdb) p lbound (neg_array) $1 = (-8, -10) (gdb) p lbound (neg_array, 1) $3 = -8 (gdb) p lbound (neg_array, 2) $5 = -10 gdb/ChangeLog: * f-exp.y (UNOP_OR_BINOP_INTRINSIC): New token. (exp): New pattern using UNOP_OR_BINOP_INTRINSIC. (one_or_two_args): New pattern. (f77_keywords): Add lbound and ubound. * f-lang.c (fortran_bounds_all_dims): New function. (fortran_bounds_for_dimension): New function. (evaluate_subexp_f): Handle FORTRAN_LBOUND and FORTRAN_UBOUND. (operator_length_f): Likewise. (print_subexp_f): Likewise. (dump_subexp_body_f): Likewise. (operator_check_f): Likewise. * std-operator.def (FORTRAN_LBOUND): Define. (FORTRAN_UBOUND): Define. gdb/testsuite/ChangeLog: * gdb.fortran/lbound-ubound.F90: New file. * gdb.fortran/lbound-ubound.exp: New file.
Diffstat (limited to 'gdb/std-operator.def')
-rw-r--r--gdb/std-operator.def4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
index 925e2b6..aad8999 100644
--- a/gdb/std-operator.def
+++ b/gdb/std-operator.def
@@ -442,3 +442,7 @@ OP (UNOP_FORTRAN_CEILING)
/* Two operand builtins. */
OP (BINOP_FORTRAN_CMPLX)
OP (BINOP_FORTRAN_MODULO)
+
+/* Builtins that take one or two operands. */
+OP (FORTRAN_LBOUND)
+OP (FORTRAN_UBOUND)