aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.rust/expr.exp
diff options
context:
space:
mode:
authorDan Robertson <danlrobertson89@gmail.com>2018-04-28 03:18:00 +0000
committerTom Tromey <tom@tromey.com>2018-04-30 23:02:01 -0600
commit1632f8baf04e7351f387e58957fc04498d90987d (patch)
treecf269dd68ec1db621ddadd18abe7851d1f249318 /gdb/testsuite/gdb.rust/expr.exp
parente31efe56455e4a0e84d2157e942e51f8ac94e9fc (diff)
downloadbinutils-1632f8baf04e7351f387e58957fc04498d90987d.zip
binutils-1632f8baf04e7351f387e58957fc04498d90987d.tar.gz
binutils-1632f8baf04e7351f387e58957fc04498d90987d.tar.bz2
rust: Fix null deref when casting (PR 23124)
Fix a null dereference when casting a value to a unit type. ChangeLog 2018-04-28 Dan Robertson <danlrobertson89@gmail.com> PR rust/23124 * gdb/rust-exp.y (convert_params_to_types): Ensure that the params pointer is not null before dereferencing it. testsuite/ChangeLog 2018-04-28 Dan Robertson <danlrobertson89@gmail.com> PR rust/23124 * gdb.rust/expr.exp: Test that the unit type is correctly parsed when casting.
Diffstat (limited to 'gdb/testsuite/gdb.rust/expr.exp')
-rw-r--r--gdb/testsuite/gdb.rust/expr.exp4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.rust/expr.exp b/gdb/testsuite/gdb.rust/expr.exp
index 0bc0630..22e6b49 100644
--- a/gdb/testsuite/gdb.rust/expr.exp
+++ b/gdb/testsuite/gdb.rust/expr.exp
@@ -133,7 +133,9 @@ gdb_test "print \[23usize; 4\]" " = \\\[23, 23, 23, 23\\\]"
gdb_test "ptype \[23usize; 4\]" " = \\\[usize; 4\\\]"
gdb_test "print \[mut 23usize; 4\]" " = \\\[23, 23, 23, 23\\\]"
-# Test a lexer corner case.
+# Test lexer corner cases.
+gdb_test "print 0x0 as *const ()" " = \\\(\\\(\\\) \\*\\\) 0x0"
+gdb_test "print 0x0 as fn(i64) -> ()" " = \\\(\\\(\\\) \\\(\\*\\\)\\\(i64\\\)\\\) 0x0"
gdb_test "print r#" "syntax error in expression, near `#'\\."
gdb_test "printf \"%d %d\\n\", 23+1, 23-1" "24 22"