F diff --git a/src/semantics/ast.c b/src/semantics/ast.c
--- a/src/semantics/ast.c
+++ b/src/semantics/ast.c
{
struct Type *left_type;
left_type=extract_expresion_value_type(left->value,translation_data);
- left_type=get_unqualified_version_of_type(left_type);
+ left_type=get_unqualified_version_of_type(left_type,translation_data);
right=get_cast_expression_tree(right,left_type,translation_data);
return get_binary_expression_tree(left,right,get_expression_value_rvalue(get_temp_object(left_type)),OP_ASSIGN);
{
struct Type *left_type;
left_type=extract_expresion_value_type(left->value,translation_data);
- left_type=get_unqualified_version_of_type(left_type);
+ left_type=get_unqualified_version_of_type(left_type,translation_data);
right=get_cast_expression_tree(right,left_type,translation_data);
return get_binary_expression_tree(left,right,get_expression_value_rvalue(get_temp_object(left_type)),OP_ASSIGN);
F diff --git a/src/semantics/value/type.c b/src/semantics/value/type.c
--- a/src/semantics/value/type.c
+++ b/src/semantics/value/type.c
}
struct Type* get_type_bitfield(struct Type *base,struct AST* number_of_bits,struct Translation_Data *translation_data)
{
- struct Type_Bit_Field *ret;
- ret=calloc(1,sizeof(struct Type_Bit_Field));
- ret->specifier=TS_BITFIELD;
+ size_t hold_number_of_bits=0;
assert(number_of_bits!=NULL);
- ret->number_of_bits=evaluate_const_expression_integer(number_of_bits,translation_data);
+ hold_number_of_bits=evaluate_const_expression_integer(number_of_bits,translation_data);
delete_ast(number_of_bits);
+ return get_type_bitfield_inner(base,hold_number_of_bits,translation_data);
+
+ }
+ struct Type* get_type_bitfield_inner(struct Type *base,size_t number_of_bits,struct Translation_Data *translation_data)
+ {
+
+ struct Type_Bit_Field *ret;
+ ret=calloc(1,sizeof(struct Type_Bit_Field));
+ ret->specifier=TS_BITFIELD;
+ ret->number_of_bits=number_of_bits;
+
ret->base=base;
ret=(struct Type_Bit_Field*)type_check_and_push((struct Type*)ret,base->node,sizeof(struct Type_Bit_Field));
}
/*TODO*/
- struct Type* get_unqualified_version_of_type(struct Type *type)
+ struct Type* get_unqualified_version_of_type(struct Type *type,struct Translation_Data *translation_data)
{
- return type;
+ struct Denotation_Prototype *prototype;
+ struct Type *hold_unqualified_type;
+
+ prototype=(struct Denotation_Prototype*)get_denotation_prototype(translation_data->types);
+
+ switch(type->specifier)
+ {
+ case TS_VOID:
+ case TS_CHAR:
+ case TS_INT:
+ case TS_FLOAT:
+ case TS_DOUBLE:
+ prototype->specifier=type->specifier;
+
+ hold_unqualified_type=get_basic_type(prototype);
+ break;
+ case TS_STRUCT:
+ case TS_UNION:
+ prototype->specifier=type->specifier;
+ prototype->struct_union=((struct Type_Struct_Union*)type)->struct_union;
+ hold_unqualified_type=get_struct_union_type(prototype);
+ break;
+ case TS_ENUM:
+ prototype->specifier=TS_ENUM;
+ prototype->enumerator=((struct Type_Enum*)type)->enumeration;
+
+ hold_unqualified_type=get_enum_type(prototype);
+ break;
+ case TS_POINTER:
+ hold_unqualified_type=get_pointer_type(((struct Type_Pointer*)type)->points_to,0,0);
+ break;
+ case TS_ARRAY:
+ hold_unqualified_type=type;
+ break;
+ case TS_FUNC:
+ hold_unqualified_type=type;
+ break;
+ case TS_BITFIELD:
+ hold_unqualified_type=get_type_bitfield_inner(((struct Type_Bit_Field*)type)->base,((struct Type_Bit_Field*)type)->number_of_bits,translation_data);
+ break;
+ default:
+ return NULL;
+
+ }
+ delete_denoted_prototype(prototype);
+ return hold_unqualified_type;
}
/*TODO*/
int type_get_integer_conversion_rank(struct Type_Basic *type)
F diff --git a/src/semantics/value/type.h b/src/semantics/value/type.h
--- a/src/semantics/value/type.h
+++ b/src/semantics/value/type.h
struct Type* get_array_type(struct Type *array_of,struct AST* number_of_elements,struct Translation_Data *translation_data);
struct Type* get_enum_type(struct Denotation_Prototype *prototype);
struct Type* get_type_bitfield(struct Type *base,struct AST* number_of_bits,struct Translation_Data *translation_data);
+ struct Type* get_type_bitfield_inner(struct Type *base,size_t number_of_bits,struct Translation_Data *translation_data);
struct Type* get_function_type(struct Type *return_type,struct Queue *parameters,struct Normal_Scope* function_prototype_scope);
struct Type_Basic* get_type_insecure(enum Type_Specifier type_specifier,enum Type_Signedness sign,enum Type_Constraint constraint,size_t type_size,struct Translation_Data *translation_data);
struct Type* get_type_for_promotion(struct Type *type,struct Translation_Data *translation_data);
- struct Type* get_unqualified_version_of_type(struct Type *type);
+ struct Type* get_unqualified_version_of_type(struct Type *type,struct Translation_Data *translation_data);
void delete_enum(struct Enum *enumeration);
void delete_struct_union(struct Struct_Union *su);