fix problems with local anonymous declarations
authorMatthias Braun <matze@braunis.de>
Tue, 18 Dec 2007 00:49:55 +0000 (00:49 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 18 Dec 2007 00:49:55 +0000 (00:49 +0000)
[r18793]

ast2firm.c
parser.c
parsetest/cp_error008.c

index 05e9157..4cc9da6 100644 (file)
@@ -3110,6 +3110,9 @@ static ir_node *compound_statement_to_firm(compound_statement_t *compound)
 
 static void create_local_declaration(declaration_t *declaration)
 {
+       if(declaration->symbol == NULL)
+               return;
+
        type_t *type = skip_typeref(declaration->type);
 
        switch ((storage_class_tag_t) declaration->storage_class) {
index e1a6ac8..fd62ec3 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2326,7 +2326,9 @@ static declaration_t *internal_record_declaration(
                check_type_of_main(declaration, &type->function);
        }
 
-       declaration_t *const previous_declaration = get_declaration(symbol, namespc);
+       assert(declaration->symbol != NULL);
+       declaration_t *previous_declaration = get_declaration(symbol, namespc);
+
        assert(declaration != previous_declaration);
        if (previous_declaration != NULL) {
                if (previous_declaration->parent_scope == scope) {
@@ -2442,7 +2444,6 @@ warn_redundant_declaration:
        }
 
        assert(declaration->parent_scope == NULL);
-       assert(declaration->symbol != NULL);
        assert(scope != NULL);
 
        declaration->parent_scope = scope;
@@ -2649,7 +2650,7 @@ static void parse_declaration(parsed_declaration_func finished_declaration)
        parse_declaration_specifiers(&specifiers);
 
        if(token.type == ';') {
-               parse_anonymous_declaration_rest(&specifiers, finished_declaration);
+               parse_anonymous_declaration_rest(&specifiers, append_declaration);
        } else {
                declaration_t *declaration = parse_declarator(&specifiers, /*may_be_abstract=*/false);
                parse_declaration_rest(declaration, &specifiers, finished_declaration);
index 22fdf82..28689a9 100644 (file)
@@ -5,7 +5,7 @@ int FirstOne(long long arg1)
                long long d;
        };
 
-       union doub xx;
+       union doub x;
        x.d = arg1;
        return x.i[2];
 }