aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.fortran/intrinsics.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.fortran/intrinsics.exp')
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsics.exp46
1 files changed, 41 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.fortran/intrinsics.exp b/gdb/testsuite/gdb.fortran/intrinsics.exp
index c402073..29cff35 100644
--- a/gdb/testsuite/gdb.fortran/intrinsics.exp
+++ b/gdb/testsuite/gdb.fortran/intrinsics.exp
@@ -61,15 +61,37 @@ gdb_test "p mod (-8, 5)" " = -3"
gdb_test "p mod (8, -5)" " = 3"
gdb_test "p mod (-8, -5)" " = -3"
-# Test CEILING
+# Test CEILING and FLOOR.
+gdb_test "p floor (3.7)" " = 3"
gdb_test "p ceiling (3.7)" " = 4"
-gdb_test "p ceiling (-3.7)" " = -3"
-# Test FLOOR
-
-gdb_test "p floor (3.7)" " = 3"
gdb_test "p floor (-3.7)" " = -4"
+gdb_test "p ceiling (-3.7)" " = -3"
+
+gdb_test "p ceiling (3)" "argument to CEILING must be of type float"
+gdb_test "p floor (1)" "argument to FLOOR must be of type float"
+
+foreach op {floor ceiling} {
+ gdb_test "ptype ${op} (3.7)" "integer\\*4"
+ gdb_test "ptype ${op} (-1.1, 1)" "type = integer\\*1"
+ gdb_test "ptype ${op} (-1.1, 2)" "type = integer\\*2"
+ gdb_test "ptype ${op} (-1.1, 3)" "unsupported kind 3 for type integer\\*4"
+ gdb_test "ptype ${op} (-1.1, 4)" "type = integer\\*4"
+ gdb_test "ptype ${op} (-1.1, 8)" "type = integer\\*8"
+
+ # The actual overflow behavior differs in ifort/ifx/gfortran - this tests
+ # the GDB internal overflow behavior - not a compiler dependent one.
+ gdb_test "p ${op} (129.0,1)" " = -127"
+ gdb_test "p ${op} (129.0,2)" " = 129"
+ gdb_test "p ${op} (-32770.0,1)" " = -2"
+ gdb_test "p ${op} (-32770.0,2)" " = 32766"
+ gdb_test "p ${op} (-32770.0,4)" " = -32770"
+ gdb_test "p ${op} (2147483652.0,1)" " = 4"
+ gdb_test "p ${op} (2147483652.0,2)" " = 4"
+ gdb_test "p ${op} (2147483652.0,4)" " = -2147483644"
+ gdb_test "p ${op} (2147483652.0,8)" " = 2147483652"
+}
# Test MODULO
@@ -85,6 +107,20 @@ gdb_test "ptype MODULO (3.0,2.0)" "type = real\\*8"
gdb_test "p CMPLX (4.1, 2.0)" " = \\(4.$decimal,2\\)"
+gdb_test "p cmplx (4,4)" "= \\(4,4\\)"
+gdb_test "ptype cmplx (4,4)" "= complex\\*4"
+gdb_test "p cmplx (-14,-4)" "= \\(-14,-4\\)"
+gdb_test "p cmplx (4,4,4)" "\\(4,4\\)"
+gdb_test "p cmplx (4,4,8)" "\\(4,4\\)"
+gdb_test "p cmplx (4,4,16)" "\\(4,4\\)"
+gdb_test "ptype cmplx (4,4,4)" "= complex\\*4"
+gdb_test "ptype cmplx (4,4,8)" "= complex\\*8"
+gdb_test "ptype cmplx (4,4,16)" "= complex\\*16"
+
+gdb_test "p cmplx (4,4,1)" "unsupported kind 1 for type complex\\*4"
+gdb_test "p cmplx (4,4,-1)" "unsupported kind -1 for type complex\\*4"
+gdb_test "p cmplx (4,4,2)" "unsupported kind 2 for type complex\\*4"
+
# Test LOC
gdb_test "p/x LOC(l)" "= $hex"