register int len;
struct type *type1, *type2, *valptrtype;
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
+ COERCE_NUMBER (arg1);
+ COERCE_NUMBER (arg2);
type1 = check_typedef (VALUE_TYPE (arg1));
type2 = check_typedef (VALUE_TYPE (arg2));
value_ptr arg1, arg2;
{
struct type *type1, *type2;
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
+ COERCE_NUMBER (arg1);
+ COERCE_NUMBER (arg2);
type1 = check_typedef (VALUE_TYPE (arg1));
type2 = check_typedef (VALUE_TYPE (arg2));
{
value_ptr bound;
int c_style = current_language->c_style_arrays;
- struct type *tarray, *tint;
+ struct type *tarray;
COERCE_REF (array);
tarray = check_typedef (VALUE_TYPE (array));
LONGEST index = value_as_long (idx);
value_ptr v;
int offset, byte, bit_index;
- LONGEST lowerbound, upperbound, word;
+ LONGEST lowerbound, upperbound;
get_discrete_bounds (range_type, &lowerbound, &upperbound);
if (index < lowerbound || index > upperbound)
error ("bitstring index out of range");
byte = *((char*)VALUE_CONTENTS (array) + offset);
bit_index = index % TARGET_CHAR_BIT;
byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index);
- v = value_from_longest (builtin_type_int, byte & 1);
+ v = value_from_longest (LA_BOOL_TYPE, byte & 1);
VALUE_BITPOS (v) = bit_index;
VALUE_BITSIZE (v) = 1;
VALUE_LVAL (v) = VALUE_LVAL (array);
{
struct type *array_type = check_typedef (VALUE_TYPE (array));
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
- int elt_size = TYPE_LENGTH (elt_type);
+ unsigned int elt_size = TYPE_LENGTH (elt_type);
LONGEST index = value_as_long (idx);
- int elt_offs = elt_size * longest_to_int (index - lowerbound);
+ unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
value_ptr v;
if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
value_ptr arg1, arg2;
{
struct type *type1, *type2;
- if (op == BINOP_ASSIGN)
+ if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
return 0;
type1 = check_typedef (VALUE_TYPE (arg1));
type2 = check_typedef (VALUE_TYPE (arg2));
char tstr[13], mangle_tstr[13];
int static_memfuncp;
+ COERCE_REF (arg1);
COERCE_ENUM (arg1);
/* now we know that what we have to do is construct our
struct type *type1 = check_typedef (VALUE_TYPE (arg1));
struct type *type2 = check_typedef (VALUE_TYPE (arg2));
+ COERCE_VARYING_ARRAY (arg1, type1);
+ COERCE_VARYING_ARRAY (arg2, type2);
+
/* First figure out if we are dealing with two values to be concatenated
or a repeat count and a value to be repeated. INVAL1 is set to the
first of two concatenated values, or the repeat count. INVAL2 is set
register value_ptr val;
struct type *type1, *type2;
+ COERCE_REF (arg1);
+ COERCE_REF (arg2);
COERCE_ENUM (arg1);
COERCE_ENUM (arg2);
type1 = check_typedef (VALUE_TYPE (arg1));
/* FIXME-if-picky-about-floating-accuracy: Should be doing this
in target format. real.c in GCC probably has the necessary
code. */
- double v1, v2, v;
+ DOUBLEST v1, v2, v;
v1 = value_as_double (arg1);
v2 = value_as_double (arg2);
switch (op)
error ("Integer-only operation on floating point number.");
}
- val = allocate_value (builtin_type_double);
+ /* If either arg was long double, make sure that value is also long
+ double. */
+
+ if (TYPE_LENGTH(type1) * 8 > TARGET_DOUBLE_BIT
+ || TYPE_LENGTH(type2) * 8 > TARGET_DOUBLE_BIT)
+ val = allocate_value (builtin_type_long_double);
+ else
+ val = allocate_value (builtin_type_double);
+
store_floating (VALUE_CONTENTS_RAW (val), TYPE_LENGTH (VALUE_TYPE (val)),
v);
}
/* FIXME: This implements ANSI C rules (also correct for C++).
What about FORTRAN and chill? */
{
- int promoted_len1 = TYPE_LENGTH (type1);
- int promoted_len2 = TYPE_LENGTH (type2);
+ unsigned int promoted_len1 = TYPE_LENGTH (type1);
+ unsigned int promoted_len2 = TYPE_LENGTH (type2);
int is_unsigned1 = TYPE_UNSIGNED (type1);
int is_unsigned2 = TYPE_UNSIGNED (type2);
- int result_len;
+ unsigned int result_len;
int unsigned_operation;
/* Determine type length and signedness after promotion for
register char *p;
struct type *type1;
- COERCE_ARRAY (arg1);
+ COERCE_NUMBER (arg1);
type1 = check_typedef (VALUE_TYPE (arg1));
if (TYPE_CODE (type1) == TYPE_CODE_FLT)
enum type_code code1;
enum type_code code2;
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
+ COERCE_NUMBER (arg1);
+ COERCE_NUMBER (arg2);
type1 = check_typedef (VALUE_TYPE (arg1));
type2 = check_typedef (VALUE_TYPE (arg2));
return (CORE_ADDR) value_as_long (arg1) == value_as_pointer (arg2);
else if (code1 == code2
- && ((len = TYPE_LENGTH (type1))
- == TYPE_LENGTH (type2)))
+ && ((len = (int) TYPE_LENGTH (type1))
+ == (int) TYPE_LENGTH (type2)))
{
p1 = VALUE_CONTENTS (arg1);
p2 = VALUE_CONTENTS (arg2);
register enum type_code code2;
struct type *type1, *type2;
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
+ COERCE_NUMBER (arg1);
+ COERCE_NUMBER (arg2);
type1 = check_typedef (VALUE_TYPE (arg1));
type2 = check_typedef (VALUE_TYPE (arg2));
{
register struct type *type;
+ COERCE_REF (arg1);
COERCE_ENUM (arg1);
type = check_typedef (VALUE_TYPE (arg1));
value_complement (arg1)
register value_ptr arg1;
{
+ COERCE_REF (arg1);
COERCE_ENUM (arg1);
if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_INT)
int member;
struct type *settype = check_typedef (VALUE_TYPE (set));
struct type *eltype = check_typedef (VALUE_TYPE (element));
+ if (TYPE_CODE (eltype) == TYPE_CODE_RANGE)
+ eltype = TYPE_TARGET_TYPE (eltype);
if (TYPE_CODE (settype) != TYPE_CODE_SET)
error ("Second argument of 'IN' has wrong type");
if (TYPE_CODE (eltype) != TYPE_CODE_INT
value_as_long (element));
if (member < 0)
error ("First argument of 'IN' not in range");
- return value_from_longest (builtin_type_int, member);
+ return value_from_longest (LA_BOOL_TYPE, member);
}
void