F diff --git a/src/semantics/ast.c b/src/semantics/ast.c --- a/src/semantics/ast.c +++ b/src/semantics/ast.creturn ret;}+ struct AST_Unary_Expression* get_indirection_expression_tree(struct AST_Expression *operand,struct Translation_Data *translation_data)+ {+ struct Type_Pointer *operand_type;+ struct AST_Unary_Expression *ret;++ operand_type=extract_expresion_value_type(operand->value,translation_data);+ if(operand_type->specifier!=TS_POINTER)+ { push_translation_error("using non pointer type in indirection operator",translation_data);return NULL; }++ ret=malloc(sizeof(struct AST_Unary_Expression));+ ret->type=OP_DEREFERENCE;+ ret->operand=operand;+ ret->value=get_expression_value_lvalue(get_temp_object(operand_type->points_to));++ return ret;++ }+ struct AST_Unary_Expression* get_address_expression_tree(struct AST_Expression *operand)+ {+ struct AST_Unary_Expression *ret;+ struct Type *operand_type;+ operand_type=extract_expresion_value_type(operand->value);+ if(operand->value->type==VALUE_FUNCTION_DESIGNATOR || operand->type==OP_ARR_SUBSCRIPT || operand->type==OP_DEREFERENCE)+ {+ ret=malloc(sizeof(struct AST_Unary_Expression));+ ret->type=OP_ADDR_OF;+ ret->operand=operand;+ ret->value=get_expression_value_rvalue(get_temp_object(get_pointer_type(operand_type,0,0)));++ return ret;+ }else if(operand->value->type==Expression_Value_LValue)+ {+ if(operand_type->specifier==TS_BITFIELD || ((struct Expression_Value_LValue*)operand->value)->object->storage_class==SCS_REGISTER)+ { push_translation_error("can't get the addres of such an operand",translation_data);return NULL; }++ ret=malloc(sizeof(struct AST_Unary_Expression));+ ret->type=OP_ADDR_OF;+ ret->operand=operand;+ ret->value=get_expression_value_rvalue(get_temp_object(get_pointer_type(operand_type,0,0)));++ return ret;+ }else+ {+ push_translation_error("cast type needs to be of scalar type",translation_data);+ return NULL;+ }+ }++struct AST_Unary_Expression* get_cast_expression_tree(struct AST_Expression *operand,struct Type *type,struct Translation_Data *translation_data){struct AST_Unary_Expression *ret;/*TODO could optimise this*/ret->right=(struct AST_Expression*)get_designator_tree(id,(struct Scope*)struct_union->inner_namespace,translation_data);+ if(struct_union_type->is_const || !(ret->right->is_modifiable))+ ret->is_modifiable=0;+ else+ ret->is_modifiable=1;return ret;}/*TODO beware const type qualifier*/if(type_is_struct_union(struct_union_type)){push_translation_error("expected pointer to struct or union in member trough ptr access",translation_data);return NULL;}- ((struct Type_Struct_Union*)struct_union_type)->struct_union->inner_namespace+ struct_union=((struct Type_Struct_Union*)struct_union_type)->struct_union;+ return}struct AST_Conditional_Expression* get_conditional_expression_tree(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right)F diff --git a/src/semantics/ast.h b/src/semantics/ast.h --- a/src/semantics/ast.h +++ b/src/semantics/ast.hstruct AST_Function_Expression* get_function_expression_tree(struct AST_Expression *id,struct Scope *scope);struct AST_Unary_Expression* get_unary_expression_tree(struct AST_Expression *operand,enum AST_Type type);+ struct AST_Unary_Expression* get_indirection_expression_tree(struct AST_Expression *operand,struct Translation_Data *translation_data);+ struct AST_Unary_Expression* get_address_expression_tree(struct AST_Expression *operand);struct AST_Unary_Expression* get_sizeof_by_type_tree(struct Type *type);struct AST_Unary_Expression* get_cast_expression_tree(struct AST_Expression *operand,struct Type *type,struct Translation_Data *translation_data);F diff --git a/src/semantics/value/value.c b/src/semantics/value/value.c --- a/src/semantics/value/value.c +++ b/src/semantics/value/value.cret=malloc(sizeof(struct Expression_Value_LValue));ret->type=VALUE_LVALUE;ret->object=object;+ if(type_is_constant_or_has_constant_member(object->type))+ ret->is_modifiable=0;+ else+ ret->is_modifiable=1;return (struct Expression_Value*)ret;}