+2016-06-10 Tom Tromey <tom@tromey.com>
+
+ PR rust/20110:
+ * rust-exp.y (lex_number): Don't truncate large numbers to i32.
+
2016-06-10 Tom Tromey <tom@tromey.com>
* Makefile.in (COMMON_OBS): Remove rust-exp.o.
int match;
int is_integer = 0;
int could_be_decimal = 1;
+ int implicit_i32 = 0;
char *type_name = NULL;
struct type *type;
int end_index;
is_integer = 1;
end_index = subexps[INT_TEXT].rm_eo;
if (subexps[INT_TYPE].rm_so == -1)
- type_name = "i32";
+ {
+ type_name = "i32";
+ implicit_i32 = 1;
+ }
else
{
type_index = INT_TYPE;
end_index = subexps[0].rm_eo;
type_name = "i32";
could_be_decimal = 1;
+ implicit_i32 = 1;
}
}
/* Parse the number. */
if (is_integer)
{
+ uint64_t value;
int radix = 10;
if (number[0] == '0')
{
could_be_decimal = 0;
}
}
- rustyylval.typed_val_int.val = strtoul (number, NULL, radix);
+
+ value = strtoul (number, NULL, radix);
+ if (implicit_i32 && value >= ((uint64_t) 1) << 31)
+ type = rust_type ("i64");
+
+ rustyylval.typed_val_int.val = value;
rustyylval.typed_val_int.type = type;
}
else
+2016-06-10 Tom Tromey <tom@tromey.com>
+
+ PR rust/20110:
+ * gdb.rust/expr.exp: Add test for integer constant larger than
+ i32.
+
2016-06-10 Bernhard Heckel <bernhard.heckel@intel.com>
* gdb.fortran/nested-funcs.exp: New.
gdb_test "print 32usize >> 5" " = 1"
gdb_test "ptype 32i32 as f64" "type = f64"
+gdb_test "ptype 0xf9f9f9f90000" "type = i64"
+
gdb_test "print ()" " = \\(\\)"
gdb_test "print \[1,2,3,4\]" " = \\\[1, 2, 3, 4\\\]"