From 801c6d64cae47d0c7ffc55c53a0f3c599bc0dcaf Mon Sep 17 00:00:00 2001 From: Thomas Schmid Date: Fri, 6 Feb 2009 12:51:34 +0000 Subject: Fix implicit cast to float Was:Re: Initializing float variables without type suffix) > cast_to() seems fine. > > In expanding stage, cast_value() did not cast the constant > correctly. You're right, I also noticed this in the meantime. The decision, whether newtype is int_type or fp_type is not made correctly. The following patch seems to work: Fix implicit cast to float Patch modified by Chris. Signed-Off-By: Thomas Schmid Signed-Off-By: Christopher Li --- evaluate.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'evaluate.c') diff --git a/evaluate.c b/evaluate.c index 358842b..5c3812e 100644 --- a/evaluate.c +++ b/evaluate.c @@ -313,37 +313,6 @@ static struct expression * cast_to(struct expression *old, struct symbol *type) return expr; } -static int is_type_type(struct symbol *type) -{ - return (type->ctype.modifiers & MOD_TYPE) != 0; -} - -int is_ptr_type(struct symbol *type) -{ - if (type->type == SYM_NODE) - type = type->ctype.base_type; - return type->type == SYM_PTR || type->type == SYM_ARRAY || type->type == SYM_FN; -} - -static inline int is_float_type(struct symbol *type) -{ - if (type->type == SYM_NODE) - type = type->ctype.base_type; - return type->ctype.base_type == &fp_type; -} - -static inline int is_byte_type(struct symbol *type) -{ - return type->bit_size == bits_in_char && type->type != SYM_BITFIELD; -} - -static inline int is_void_type(struct symbol *type) -{ - if (type->type == SYM_NODE) - type = type->ctype.base_type; - return type == &void_ctype; -} - enum { TYPE_NUM = 1, TYPE_BITFIELD = 2, -- cgit v1.2.3-65-gdbad