From: Christoph Mallon Date: Thu, 2 Oct 2008 21:51:20 +0000 (+0000) Subject: skip_typeref(). X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=aaec5b181cd75ae54480c88f1458d476071d7f51;p=cparser skip_typeref(). [r22424] --- diff --git a/ast2firm.c b/ast2firm.c index d237cfb..e3304d0 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -2540,7 +2540,6 @@ static long get_offsetof_offset(const offsetof_expression_t *expression) expression_t *array_index = designator->array_index; assert(designator->array_index != NULL); assert(is_type_array(type)); - assert(is_type_valid(array_index->base.type)); long index = fold_constant(array_index); ir_type *arr_type = get_ir_type(type); @@ -2644,6 +2643,8 @@ static void init_ir_types(void); long fold_constant(const expression_t *expression) { + assert(is_type_valid(skip_typeref(expression->base.type))); + bool constant_folding_old = constant_folding; constant_folding = true; @@ -3455,7 +3456,6 @@ static void walk_designator(type_path_t *path, const designator_t *designator) expression_t *array_index = designator->array_index; assert(designator->array_index != NULL); assert(is_type_array(type)); - assert(is_type_valid(array_index->base.type)); long index = fold_constant(array_index); assert(index >= 0); diff --git a/parser.c b/parser.c index 3d864ac..12f8f8e 100644 --- a/parser.c +++ b/parser.c @@ -7653,7 +7653,7 @@ static void semantic_take_addr(unary_expression_t *expression) value->base.type = revert_automatic_type_conversion(value); type_t *orig_type = value->base.type; - if (!is_type_valid(orig_type)) + if (!is_type_valid(skip_typeref(orig_type))) return; set_address_taken(value, false); @@ -8804,7 +8804,7 @@ static statement_t *parse_case_statement(void) /* This check does not prevent the error message in all cases of an * prior error while parsing the expression. At least it catches the * common case of a mistyped enum entry. */ - if (is_type_valid(end_range->base.type)) { + if (is_type_valid(skip_typeref(end_range->base.type))) { errorf(pos, "case range does not reduce to an integer constant"); } statement->case_label.is_bad = true;