diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-01-18 14:44:48 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-03-06 18:11:31 +0000 |
commit | 0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9 (patch) | |
tree | 91f447c2bbfe0f87c46e7a42205ca8d63ca86ec8 /gdb/testsuite/gdb.fortran | |
parent | 4a270568d93263e4970099456b4efb58466134a6 (diff) | |
download | gdb-0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9.zip gdb-0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9.tar.gz gdb-0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9.tar.bz2 |
gdb/fortran: Add support for the ABS intrinsic function
Adds support for the abs intrinsic function, this requires adding a
new pattern to the Fortran parser. Currently only float and integer
argument types are supported to ABS, complex is still not supported,
this can be added later if needed.
gdb/ChangeLog:
* f-exp.y: New token, UNOP_INTRINSIC.
(exp): New pattern using UNOP_INTRINSIC token.
(f77_keywords): Add 'abs' keyword.
* f-lang.c: Add 'target-float.h' and 'math.h' includes.
(value_from_host_double): New function.
(evaluate_subexp_f): Support UNOP_ABS.
gdb/testsuite/ChangeLog:
* gdb.fortran/intrinsics.exp: Extend to cover ABS.
Diffstat (limited to 'gdb/testsuite/gdb.fortran')
-rw-r--r-- | gdb/testsuite/gdb.fortran/intrinsics.exp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.fortran/intrinsics.exp b/gdb/testsuite/gdb.fortran/intrinsics.exp index 674f299..00396c7 100644 --- a/gdb/testsuite/gdb.fortran/intrinsics.exp +++ b/gdb/testsuite/gdb.fortran/intrinsics.exp @@ -40,3 +40,12 @@ gdb_test "p kind (l2)" " = 2" gdb_test "p kind (l4)" " = 4" gdb_test "p kind (l8)" " = 8" gdb_test "p kind (s1)" "argument to kind must be an intrinsic type" + +# Test ABS + +gdb_test "p abs (-11)" " = 11" +gdb_test "p abs (11)" " = 11" +# Use `$decimal` to match here as we depend on host floating point +# rounding, which can vary. +gdb_test "p abs (-9.1)" " = 9.$decimal" +gdb_test "p abs (9.1)" " = 9.$decimal" |