+2011-07-27 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Pedro Alves <pedro@codesourcery.com>
+
+ * eval.c (evaluate_subexp_standard): Remove not_lval from all calls of
+ value_one.
+ * valops.c (value_one): Remove parameter lv. Do not pass it to itself.
+ Assert the result kind.
+ * value.h (value_one): Remove parameter lv.
+
2011-07-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix crash on lval_computed values.
{
struct value *v_one, *retval;
- v_one = value_one (value_type (arg2), not_lval);
+ v_one = value_one (value_type (arg2));
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one);
retval = value_binop (arg1, v_one, op);
return retval;
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD);
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB);
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD);
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB);
}
return val;
}
-/* Create a value of numeric type TYPE that is one, and return it. */
+/* Create a not_lval value of numeric type TYPE that is one, and return it. */
struct value *
-value_one (struct type *type, enum lval_type lv)
+value_one (struct type *type)
{
struct type *type1 = check_typedef (type);
struct value *val;
val = allocate_value (type);
for (i = 0; i < high_bound - low_bound + 1; i++)
{
- tmp = value_one (eltype, lv);
+ tmp = value_one (eltype);
memcpy (value_contents_writeable (val) + i * TYPE_LENGTH (eltype),
value_contents_all (tmp), TYPE_LENGTH (eltype));
}
error (_("Not a numeric type."));
}
- VALUE_LVAL (val) = lv;
+ /* value_one result is never used for assignments to. */
+ gdb_assert (VALUE_LVAL (val) == not_lval);
+
return val;
}