skip_typeref().
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 2 Oct 2008 21:51:20 +0000 (21:51 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 2 Oct 2008 21:51:20 +0000 (21:51 +0000)
[r22424]

ast2firm.c
parser.c

index d237cfb..e3304d0 100644 (file)
@@ -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);
index 3d864ac..12f8f8e 100644 (file)
--- 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;