#include "block.h"
#include "charset.h"
#include "cp-support.h"
-#include "f-lang.h"
#include "gdb_obstack.h"
#include "gdb_regex.h"
#include "rust-lang.h"
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
{
struct rust_op *result = OBSTACK_ZALLOC (&work_obstack, struct rust_op);
- result->opcode = OP_F90_RANGE;
+ result->opcode = OP_RANGE;
result->left.op = lhs;
result->right.op = rhs;
}
break;
- case OP_F90_RANGE:
+ case OP_RANGE:
{
- enum f90_range_type kind = BOTH_BOUND_DEFAULT;
+ enum range_type kind = BOTH_BOUND_DEFAULT;
if (operation->left.op != NULL)
{
kind = NONE_BOUND_DEFAULT;
}
}
- write_exp_elt_opcode (state, OP_F90_RANGE);
+ write_exp_elt_opcode (state, OP_RANGE);
write_exp_elt_longcst (state, kind);
- write_exp_elt_opcode (state, OP_F90_RANGE);
+ write_exp_elt_opcode (state, OP_RANGE);
}
break;